I am dynamically creating layout and text view in android. If the text view content is large, how to wrap the content of text view dynamic开发者_JAVA百科ally?
To make a TextView wrap it's content you have to specify that it should not be treated as 'single line'. You can do this in it's XML properties or dynamically by callig:
public void setSingleLine (boolean singleLine)
If true, sets the properties of this field (lines, horizontally scrolling, transformation method) to be for a single-line input; if false, restores these to the default conditions. Note that calling this with false restores default conditions, not necessarily those that were in effect prior to calling it with true.
Related XML Attributes
- android:singleLine
An example:
value.setSingleLine(false);
http://developer.android.com/reference/android/widget/TextView.html
精彩评论