Inputtype causes textview to not be displayed in multiple rows

Source: Internet
Author: User

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.