开发者

Format buttons to fill parent based on dynamically added text

I'm hoping I can get some formatting help. I have a TableLayout. Inside the TableRow, I have 2 Rela开发者_运维技巧tiveLayouts. Each RelativeLayout has 2 buttons in it that overlap (this is by design). The button text is dynamically added at runtime. This makes the buttons taller if the text is long enough. However, the text in one column (RelativeLayout) is different that the text in other column (RelativeLayout). So, the TableRow is expanded by the taller of the buttons. What I'd like is to have the smaller buttons fill in to the same size as the larger one.

I'm real new to Android development, but I've tried every combination of match_parent/fill_parent/wrap_content that I can think of, but none of them make the buttons stay the same size (that is, the size of the larger one). Some even expand the button to the full height of the screen (which I don't understand either...I'd think that the parent would be the TableRow and that would limit it)...

I appreciate any advice.


Use

button.setEllipsize(TruncateAt.END);

attribute while creating the buttons

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜