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("<small><i>" + "Text Hint Here" + "</i></small>"));
But can you just do it from xml?
EDIT:
<EditText
android:id="@+id/term_entry"
android:layout_width="500dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/scrllyout"
android:imeOptions="actionNone|flagNoExtractUi"
android:inputType="text|textImeMultiLine"
android:singleLine="true"
android:hint="Enter Command"
android:textStyle="italic"
android:textColorHint="#30AAAAAA"
/>
try like this in XML
<EditText
android: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>
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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.