I have a listview item xml with 3 views – two text boxes and a checkbox.
I need the second textview and the checkbox to always be shown, i.e. they must not get cropped or pushed off the end of the item.
The first textview sometimes contains a long name, and this is making the second textview too narrow and pushing the checkbox off the end of the list item. The first textview needs to be the one that gets ellipsized.
I’ve tried using android:layout_weight but this makes the views always use the same width, which isn’t what I want. For instance if the 2nd textview doesn’t contain any text, I want it to completely collapse.
I’ve tried using various combinations of wrap_content/fill_parent and doing things in code but nothing seems to be working. I am currently using a linearLayout for it.
You can try using TableLayout, setting
shrinkColumnsto 0, andstretchColumnsto “1, 2”This should allow the checkbox and the second textview to take all available place, and shrink the first textview as necessary