Skip to content Skip to sidebar Skip to footer

Make Edittext Hint Italic?

How do you do this in xml, can you? I see this in a related question for the java code to do it, check length is 0 and: EditText.setText(Html.fromHtml('' + '

Solution 1:

Better use java code.use Typeface. Put your font file in assest folder. And then write below code.

italic = Typeface.createFromAsset(getAssets(), "Your font file"); 
editText.setTypeface(italic);  

Solution 2:

try like this in XML

<EditTextandroid:id="@+id/editText1"android:layout_width="fill_parent"android:layout_height="wrap_content"android:hint="hint"android:textStyle="italic" ></EditText>

to make hint use android:hint="hint" and for making italic word use like this android:textStyle="italic"

updated:

here is the XML try this, I have tested in my notebook works fine.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="fill_parent"android:layout_height="wrap_content"android:orientation="horizontal" >


<EditText
    android:id="@+id/term_entry"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_toRightOf="@+id/scrllyout"
    android:hint="Enter Command"
    android:imeOptions="actionNone|flagNoExtractUi"
    android:inputType="text|textImeMultiLine"
    android:singleLine="true"
    android:textColorHint="#ffffff"
    android:textStyle="italic" />

</LinearLayout>

Post a Comment for "Make Edittext Hint Italic?"