Android hint hint font size modification, show full

Source: Internet
Author: User

Android hint hint font size modification, show full

1. There is a problem in the work, that is, the custom EDITTEXT hint hint in the oversized font will be displayed,

2. Then search the Internet for a moment, here to record, share to everyone, here to thank the Great God who wrote this

3. The incoming hint is a spannedstring or spanned type, so you can keep the custom properties of the text

Import android.text.SpannableString;
Import android.text.Spanned;
Import android.text.SpannedString;
Import Android.text.style.AbsoluteSizeSpan;
Import android.app.Activity;
Import Android.widget.EditText;
Import Android.widget.TextView;

EditText EditText=(EditText) Rootview.Findviewbyid(R. ID. ET);Create a new text object that can add properties spannablestring SS=NewSpannablestring("TestString");Create a new Property object, set the size of the text Absolutesizespan=NewAbsolutesizespan(8,True);Attach property to Text SS.Setspan(The,0Ss.Length() ) ; //set Hintedittext.sethint (new spannedstring  (Ss) ) ; //Be sure to convert, otherwise the property disappears 






But what I'm trying to say is I found the layout file for the custom control
<com.android.xx.xx.recipientseditor

Android:id= "@+id/recipients_editor"
android:hint= "@string/to_hint_ipmsg"

Android:layout_width= "Match_parent"
android:layout_height= "Match_parent"

Android:gravity= "Center_vertical"
Android:inputtype= "TextFilter"

android:textcolorhint= "@color/conv_item_date_subjectr_text"
Android:paddingstart= "16dip"

android:layout_weight= "1"
Android:textcolor= "#000000"

/>

    also implemented in the super-large font hint prompt display full effect, but also can follow the random switch font size and change the size of 
hint, so I think this is simpler than the previous one to put hint hint font size fixed better.

Android hint prompt font size modification, display full

Related Article

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.