If you have many controls in your project that use the same style, you can set the style to the system for convenience, which is a lot easier to use.
Here's how to customize the style template.
1. Add the style content you want to set in the Style.xml file
<Resources> <!--Base application theme, dependent on API level. This theme are replaced by Appbasetheme from Res/values-vxx/styles.xml on newer devices. - <stylename= "Appbasetheme"Parent= "Theme.AppCompat.Light"> <!--Theme customizations available in newer API levels can go in res/values-vxx/styles.xml, while C Ustomizations related to Backward-compatibility can go. - </style> <!--application theme. - <stylename= "Apptheme"Parent= "Appbasetheme"> <Itemname= "Android:windownotitle">True</Item> <!--All customizations, that is, specific to a particular api-level can go. - </style> <stylename= "Text_content"> <Itemname= "Android:layout_width">Match_parent</Item> <Itemname= "Android:layout_height">55dp</Item> <Itemname= "Android:layout_marginleft">5dp</Item> <Itemname= "Android:layout_margintop">5dp</Item> <!--Custom TextView Styles - </style></Resources>
2. Refer to the front end
<TextView android:id= "@+id/baom1" style= "@style/text_content" android: Gravity= "center_vertical" android:drawableleft= "@android:d rawable/star_big_on" Android:text= "baojing"/>
3. Description:
In XML, name is a reference, item is the property name, and the corresponding value.
Android Development Learning Note-Custom TextView property templates