0

I'm using a TextView inside a a "LabeledTextView" component (Basically, a TextView whose label moves from one side to the other when dealing with Layout changes caused to due Right to Left languages). I'm using this inside a ListView and this is occuring:

enter image description here

The last line of text is being truncated horizontally. Is this perhaps a bug in Android's TextView onMeasure() ?

This same "LabeledTextView" component is used in other situations and is working completely fine, so I'm thinking this has something to do with the interaction between it and the ListView.

The corresponding part of the list item xml looks like so:

<LinearLayout
    android:layout_width="0dp"
    android:layout_weight="1"
    android:layout_height="400dp"
    android:orientation="vertical" >

    <com.test.library.view.LabeledTextView
        android:id="@+id/sender"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        custom:label="@string/sender"
        custom:labelWidth="130dp"/>      

    <com.test.library.view.LabeledTextView
        android:id="@+id/message"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        custom:label="@string/message"
        custom:labelWidth="130dp"/>                

</LinearLayout>

You can see that in the containing LinearLayout I've ensured the height of the container isn't curtailing the size.

The custom view sets the LayoutParams as WRAP_CONTENT for height - you can see it's grown to be almost the correct size.

EDIT

When increasing the size of the LabeledTextView manually however, the TextView is displaying correctly so I think the default onMeasure() of my Custom View isn't correctly accounting for the TextView childs height.

Graeme
  • 25,714
  • 24
  • 124
  • 186

1 Answers1

0

Use a different Linear Layout for the two columns you need to display the answer.

ie. one for the sender and one for the message

inquisitive
  • 3,738
  • 6
  • 30
  • 56