我正在创建一种图像库(含视图鳍状肢),其中viewflipper的每个视图都有一个imageview和两个下方的textview。我想要的是根据图像浏览宽度调整这些textviews的宽度。这些imageview和文本动态添加到viewflipper,因此无法在xml中调整宽度。此外,图像的宽度每次都是不同的(一些肖像,一些景观)。 Googleing没有帮助。所以这就是我想要的。任何帮助,将不胜感激。 Android TextView溢出
0
A
回答
4
尝试这样的,它可以帮助你
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="your image" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/imageView"
android:layout_alignRight="@+id/imageView"
android:layout_below="@+id/imageView"
android:layout_marginTop="16dp"
android:text="I am creating sort of an image gallery (with view flipper) wherein each view of viewflipper has an imageview and two textviews below it. " />
</RelativeLayout>
+0
正是我想要的感谢! – Bhaijaan
+0
它好吧,你欢迎 – user2496783
2
尝试这个
tv.setMaxLines(2);
tv.setEllipsize(TextUtils.TruncateAt.END);
更多文档:http://developer.android.com/reference/android/widget/TextView.html#attr_android:ellipsize
相关问题
- 1. TextView的溢出
- 2. textview溢出屏幕
- 3. Android TextView文本溢出指示器?
- 4. Android:从第一个TextView溢出到第二个TextView的文本
- 5. 在TextView中出现文字溢出
- 6. 的TextView在ListView:文本溢出屏幕
- 7. 未正确处理TextView溢出
- 8. 在TextView中处理溢出文本
- 9. TextView未出现,Android
- 10. Android文本溢出
- 11. Android - ImageView和TextView不出现
- 12. 堆栈溢出错误android
- 13. Android索引溢出异常
- 14. Android - 操作栏溢出
- 15. 内存溢出的Android
- 16. Android的溢出观点
- 17. Android的布局框溢出
- 18. Android操作栏,溢出
- 19. 如何让Android xml溢出
- 20. ScrollView溢出到BottomNavigation android
- 21. Phonegap和Android溢出问题
- 22. Android Stack溢出错误?
- 23. js溢出函数溢出
- 24. 的Android单独TextView的颜色和溢彩
- 25. Webview iframe溢出
- 26. 在TextView上选择溢出菜单项CustomActionModeCallback
- 27. 我有一个textview溢出,无论我给它什么参数
- 28. Android TextView
- 29. Android TextView
- 30. Android TextView
您可以发布您的布局文件? – GrIsHu
除了相对布局外,布局文件中没有任何内容。一切都是动态添加的。 – Bhaijaan
你是否动态添加'TextView'?如果是,则发布该代码。 – GrIsHu