how to to force TextView to use the available space using layout_weight?

25 Views Asked by At

I have these 6 text views in the same LinearLayout (the parent layout is a table row layout and I'm using layout_weight to split the screen width between them the text view isn't respecting the layout_weight spacing, causing the last text view to exceed the screen width (when the text views has longer text)

<TextView
        android:id="@+id/txt_equipment_description"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        android:text="Description"
        android:textStyle="bold"
        android:layout_weight="1"
        android:textSize="16sp"
        android:textColor="#4b7940"
        android:maxLines="1"
        android:ellipsize="end"
        />
0

There are 0 best solutions below