2011-06-01 100 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