I was puzzled when I encountered a problem today, that is, textview cannot automatically display multiple lines with line breaks, because my impression is that textview can automatically display multiple lines with line breaks by default. Why can't I do it today.
The final reason was found because the inputtype attribute was set.
Layout file code:
1 <relativelayout xmlns: Android = "http://schemas.android.com/apk/res/android" 2 xmlns: Tools = "http://schemas.android.com/tools" 3 Android: layout_width = "match_parent" 4 Android: layout_height = "match_parent" 5 Android: paddingbottom = "@ dimen/activity_vertical_margin" 6 Android: paddingleft = "@ dimen/users" 7 Android: paddingright = "@ dimen/activity_horizontal_margin" 8 Android: paddingtop = "@ Dimen/activity_vertical_margin "9 tools: context = ". mainactivity "> 10 11 <textview12 Android: layout_width =" wrap_content "13 Android: layout_height =" wrap_content "14 Android: inputtype =" text "15 Android: TEXT = "Have you eaten today? Have you eaten today? Have you eaten today? Have you eaten today? Have you eaten today? Have you eaten today? "/> 16 17 </relativelayout>
The display effect is as follows:
Obviously, no text content is displayed, and no line breaks are automatically displayed.
The problem was found because I accidentally set the inputtype attribute. Deleting this attribute can solve the problem.
Although it was a small problem, it took me 10 minutes to find the problem, so I recorded it for future use.