Create styling string from resources
This example show how to create partial styling string from resources:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhobkiZCc46W4XmUI2h5Ia9bh098PQuzmBkcH-L4djuHXJHe2SUq3_UxVD2PQ4jcxG4F5PkXsP8OuYdGIHMZj7o3HZM49o8jhhMV6uw_14R7pWyoVC82-hI0WOVIXvnfh5FrKzudySqkSk/s640/androidstylingstringresources.png)
Edit values/strings.xml to add string resources with styling:
<resources>
<string name="app_name">AndroidStylingStringResources</string>
<string name="normal_name">It is Normal String</string>
<string name="italic_name">Partial <i>Italic String</i> from resources</string>
<string name="bold_name">Partial <b>Bold String</b> from resources</string>
<string name="underline_name">Partial <u>Underline String</u> from resources</string>
</resources>
Edit layout/activity_main.xml to use the string resources:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android_layout_width="match_parent"
android_layout_height="match_parent"
android_padding="16dp"
android_orientation="vertical"
tools_context="com.blogspot.android_er.androidstylingstringresources.MainActivity">
<TextView
android_layout_width="wrap_content"
android_layout_height="wrap_content"
android_layout_margin="20dp"
android_layout_gravity="center_horizontal"
android_autoLink="web"
android_text="http://android-er.blogspot.com/"
android_textStyle="bold"/>
<TextView
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_textSize="28dp"
android_text="@string/normal_name"/>
<TextView
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_textSize="28dp"
android_textStyle="italic"
android_text="Whole TextView in italic style"/>
<TextView
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_textSize="28dp"
android_text="@string/italic_name"/>
<TextView
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_textSize="28dp"
android_text="@string/bold_name"/>
<TextView
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_textSize="28dp"
android_text="@string/underline_name"/>
</LinearLayout>
alternative link download