Question

I need to set the hint of a EditText as italic style, but I can't find any place how to do it.

Some one here has a clue how to do it or do I have to accept that is impossible?

Was it helpful?

Solution

Inside strings.xml

 <string name="hint1"><i>Your hint here</i></string>

In your .xml file

  <EditText android:hint="@string/hint1" />

OTHER TIPS

Add one string value in Strings.xml as <i>your hint here</i> and try to set it in your EditText in the xml

Solution 2:

if(youredittext.getText().toString().length()==0)
{
    youredittext.setTypeface(null,Typeface.ITALIC);
}
else
{
youredittext.setTypeface(null,Typeface.NORMAL);
}

Try out as below:

edittext.setHint(Html.fromHtml("<small><i>" + "Text Hint Here" + "</i></small>"));

In your xml, you can set a TextStyle. This TextStyle is applicable on your text and your hint.

<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@Your text here"
android:textStyle="italic"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top