Res/values/style. xml
<? XML version ="1.0"Encoding ="UTF-8"?> <Resources> <style name ="Style1"> <Item name ="Android: textsize"> 18sp </item> <item name ="Android: textcolor"> # Ec9273 </item> </style> <style name ="Style2"> <Item name ="Android: textsize"> 14sp </item> <item name ="Android: textcolor"># Ff7f7c </item> <item name ="Android: fromalpha"> 0.0 </item> <item name ="Android: toalpha"> 0.0 </item> </style> </resources>
Res/layout/Main. xml
<? XML version = "1.0" encoding = "UTF-8" ?> < Linearlayout Xmlns : Android = Http://schemas.android.com/apk/res/android" Android : Orientation = "Vertical" Android : Layout_width = "Fill_parent" Android : Layout_height = "Fill_parent" > < Textview Style="@ Style/style1" Android : Layout_width = "Fill_parent" Android : Layout_height = "Wrap_content" Android : Text = "@ String/hello" /> < Textview Style="@ Style/style2" Android : Layout_width = "Fill_parent" Android : Layout_height = "Wrap_content" Android :Text = "@ String/hello" /> </ Linearlayout >
Running result