tags:

views:

24

answers:

1

hi! all

<TextView
            android:id="@+id/msg"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textSize="16sp"
            android:textColor="#000000"
            android:layout_weight="2"
            android:ellipsize="end"
            android:layout_marginLeft="8dip"
            android:layout_below="@id/reply_createdAt"
            android:layout_toRightOf="@id/reply_profileImage"/>

i have a message,its content is not fixed. users message should be displayed in this textview. when i give a static message it displays in multiline, but when i use this through my code it shows only online. It do not get wrapped.

i use inflater in code, used getter/setter to set its text

pls help, thanks

A: 

You can set the lines of text to display with android:lines, or set a minimum and maximum number of lines with android:minLines and android:maxLines.

android:ellipsize would kick in only with a limited size, so if the text view is to grow to its content, it would not be needed, unless somehow constrained by the layout.

I also see you are using both layout_weight and layout_below/toRightOf. The first is available only in LinearLayout, the latter in RelativeLayout, so one of them should go, depending on which layout you are actually using.

Thorstenvv
i cannot limit its height, as message could be long or short
nish
Try it without ellipsize.
Thorstenvv