开发者

Android ListView ellipsize wide column content

I have a ListView that shows 2 columns per row. I don't have any specific column layout XML so Android is determining it for me. If the text in the 1st column is too wide then bad things happen to the layout of the 2nd column. Ideally I want Android to ellipsize the text in the 1st column at a sensible width and/or restrict the 1st column's width to 80% of the total displayable width. Can I do this in code?

Am happy to ellipsize the column 1 text itself manually when setting up the ListView if that's simple but it would have to cope with orientation changes (because in landscape the column 1 text would not be so wide as to have to ellipsize).

T开发者_开发技巧hanks.


Set the width of your textviews to a specific width, ie, 50dp instead of wrap_content. Then set ellipsize to true. The rest should take care of itself.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜