Textview with long text pushes out other views in GridLayout despite ellipsize=end

前端 未结 14 2005
星月不相逢
星月不相逢 2020-12-24 01:19

My problem is very similar to How to get a layout where one text can grow and ellipsize, but not gobble up the other elements on the layout, but read on below why I can\'t u

14条回答
  •  庸人自扰
    2020-12-24 01:52

    If the views on the right get pushed over by the text by design, you might as well use a ListView instead of a GridView.

    You would just need to make the base of the list item layout a RelativeLayout, and set rules like this:

    1. You can set the two views on the right to alignParentRight (using android:layout_alignParentLeft="true"), but make sure the first view stays to the left of the second so it will push itself to the left as the views stretch out.

    2. You can make the TextView on the left align to the left, but stay to the left of the first view (using android:layout_toLeftOf="@+id/viewId") so it won't overlap with the views.

提交回复
热议问题