The effect of Android:hint property on TextView

Source: Internet
Author: User

Recently saw a colleague wrote a piece of code, very simple is:

<linearlayout        android:layout_width= "wrap_content"        android:layout_height= "Wrap_content"        android: Layout_centervertical= "true"        android:orientation= "horizontal"        android:gravity= "center_vertical" >        <textview            android:layout_width= "wrap_content"            android:layout_height= "Wrap_content            " Android:hint= "XXXXX"            android:text= "x"           />        <textview            android:layout_width= "Wrap_ Content "            android:layout_height=" wrap_content "            android:textsize=" 16sp "            android:text=" (x) "            / >    </LinearLayout>

The results shown are as follows:


Yes, the effect is this, two x there is a large gap between the beginning I thought it was the colleague set what, later looked at the XML did not see what, thought that is set minwidth, but also did not see, the key is to show the effect has a minimum length, find a half-day, finally realized hint this attribute, After setting the Hint property, the minimum width of the corresponding TextView will also be related to the length of the text you set, which is the final reason for this problem, so I want to say the end ...

The effect of Android:hint property on TextView

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.