how to set height of textview according to its content -[android]
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 开发者_C百科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
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.
精彩评论