我正在創建一種圖像庫(含視圖鰭狀肢),其中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