I have a ListView which I’ve created a custom view for each row. My view consist of two text view that I want to display side by side. The first textview (idno) has a background image set which I center my text over. The second textview (materials) has a variable number of lines for each row.
The issue that I’m having is that the lines go beyond the right side before wrapping. It seems that it is not accounting for the first textview width.
Here is my layout file:
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent">
<TableRow>
<TextView
android:id="@+id/idno"
xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center"
android:textColor="#000000"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/materials"
xmlns:android="http://schemas.android.com/apk/res/android"
android:textColor="#0000ff"
android:textStyle="bold"
android:textSize="12sp"
android:maxLines="5"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
Any suggestions or solutions would be very much appreciated. Thanks in advanced!
I would suggest you to use
LinearLayoutwithorientation="horizontal"to display two TextViews like :