2011-06-01 104 views
0

我有一個自定義佈局的列表視圖。在佈局中,我會顯示一系列評論。問題在於,當評論太長時,背景會變得很緊張,因此我設置了這個圖像。圖像渲染九個補丁

我知道我可以使用九個補丁,但問題是它真的有效嗎?如果不是我有什麼替代方案?

有人可以推薦最好的處理方法。

what happens to the image

enter image description here

<TextView android:id="@+id/txtCommentBody" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" android:textColor="@color/black" android:paddingTop="25dip" android:paddingLeft="5dip" android:paddingRight="5dip" android:layout_marginTop="10dip" android:background="@drawable/comment_bg"> </TextView>

回答

1

九宮所以它是不會規模以下的部分將工作只要你墊文本的頂部。或者,將所有評論截斷爲適合的合理長度,並讓人們點擊它們來閱讀整個內容。

+0

我該如何「墊頂」,以便其餘部分不會縮放? – Hades 2011-06-01 09:40:15

+0

看看android:padding或setPadding - http://developer.android.com/reference/android/view/View.html#setPadding%28int,%20int,%20int,%20int%29 – 2011-06-01 10:11:53

+0

我已添加填充到頂部。參考代碼。但它仍然可以擴展整個圖像。 – Hades 2011-06-01 10:52:42