开发者

TextView subclass doesn't wrap words

I'm subclassing TextView in a class named Message and adding instances of this class into a ListView. The problem is that if the text the user sets on the Message class is too wide, the v开发者_如何学JAVAiew doesn't wrap words as expected.

What should I do?


There are a couple of things I suspect need to be done:

  1. setSingleLine to false (sounds like you should do it in the constructor of Message).
  2. Make sure the layout_height of the widget you're placing in the ListView is WRAP_CONTENT (but not the layout_width!)

You can also play with setMinLines and setLines if it better suits your needs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜