android - Why I am not able to set Italic style in my EditText? -


following code display edittext,

 <edittext      android:id="@+id/editstartingpoint"      android:layout_width="0dp"      android:layout_height="wrap_content"      android:layout_weight="1"      android:background="@null"      android:gravity="left|center_vertical"      android:hint="@string/startingpointhint"      android:inputtype="text"      android:maxlength="8"      android:padding="10dp"      android:text=""      android:textcolor="@color/login_lbl"      android:textsize="@dimen/settings_list_font_size" /> 

in activity file, oncreate() method,

edtstartpoint = (edittext) findviewbyid(r.id.editstartingpoint); edtstartpoint.settext ( html.fromhtml( "<small><i>" + "this should in italic" + "</i></small>" )); 

i tried,

edtstartpoint.settypeface( null, typeface.italic ); 

i have tried set textstyle="italic" in .xml file

but problem text not displaying in italic style, problem ? please me out.

edit : not showing text in bold format. xml preview showing fine, when run code in real device samsung s7562, displaying normal text only

edit:

adding android:textstyle xml should work.

in case if using custom font ensure font have italic style. documentation of settypeface(typeface) method:

sets typeface , style in text should displayed. note not typeface families have bold , italic variants, may need use settypeface(typeface, int) appearance want.

if custom support italic, try this, mtextview.settypeface(typeface.defaultfromstyle(typeface.italic), typeface.italic)


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -