The effect of Android:hint property on TextView

Source: Internet
Author: User

Recently saw a colleague wrote a piece of code, very easy it 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 effects shown are as follows:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvemhvdwrhawxpyw5n/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">

Yes, the effect is this, two x has a very large gap between the beginning I thought it was a colleague set what, and later looked at the XML did not see anything. Think of is set MinWidth, but also did not see, the key is to show the effect has a minimum length, find a half-day, finally realize hint this property, set the Hint property, the corresponding TextView the minimum width will be related to the length of the text you set, This is the last reason for this problem, and to this, I want to say the end of ...

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.