Sunday, 15 August 2010

android - Set text bold in resources (Custom font) -



android - Set text bold in resources (Custom font) -

i have text in android app, utilize custom font , each bold word in text want utilize bold version of font.

lorem ipsum dolor sit down amet, consectetur adipiscing elit. nunc ut feugiat neque. pellentesque vel lorem ut tortor varius congue. in arcu nibh, sodales quis tempus in, hendrerit sit down amet ante. nam european union massa purus tincidunt condimentum. integer @ turpis nec elit elementum rutrum. nunc varius sem european union velit fermentum volutpat.

how do this? know can add together html tag in resources file this:

<string name="register"><b>copyright</b></string>

but uses bold version of default font , not of custom font.

i utilize library = https://github.com/neopixl/pixlui set font in xml this

<com.neopixl.pixlui.components.textview.textview android:id="@+id/edt_birthday" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="birthday" pixlui:typeface="avenirnextcondensed_regular.ttf" />

you can utilize html.fromhtml() method <strong> tag when passing string. means have set text of view dynamically.

for example:

string mystring = html.fromhtml("lorem <strong>dolor sit down amet</strong>"); mytextview.settext(mystring);

it display:

lorem dolor sit down amet

android android-fonts

No comments:

Post a Comment