Simple exercises to customize styles and themes, style is added to view, theme is added to application or activity
Styles.xml
<?XML version= "1.0" encoding= "Utf-8"?><Resourcesxmlns:android= "Http://schemas.android.com/apk/res/android"> <!--Custom Styles - <stylename= "MyFont"> <Itemname= "Android:textcolor">#ff0000</Item> <Itemname= "Android:textsize">40sp</Item> </style> <stylename= "Myfontson"Parent= "@style/myfont"> <Itemname= "Android:textsize">30sp</Item> </style> <!--Custom Themes - <stylename= "MyTheme"> <Itemname= ' Android:windownotitle '>True</Item> <Itemname= "Android:background">#ffffff</Item> </style></Resources>
Activity_main.xml
<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:orientation= "vertical" > <TextViewstyle= "@style/myfont"Android:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:text= "Styles and Themes" /> <TextViewstyle= "@style/myfontson"Android:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:text= "Styles and Themes" /></LinearLayout>
Manifest.xml
< Application Android:allowbackup = "true" android:icon= "@drawable/ic_launcher" android:label= "ss" Android:theme = "@style/mytheme" >
[Android] Android custom styles and Themes