If the View Interface style needs to be unified, you need to use the style in the android view technology.Style is to write the style content to a separate XML file and place it in RES/values/styles. xml:
<? XML version = "1.0" encoding = "UTF-8" ?> < Resources > < Style Name = "Itemtitle" > < Item Name = "Android: textsize" > 25sp </ Item > < Item Name = "Android: textstyle" > Bold </ Item > </ Style > </ Resources >
Usage: In the layout File
<TextviewStyle = "@ style/itemtitle".../>
In R. Java
Public static final class style {
Public static final int itemtitle = 0x7f050000;
}
If you want to make a unified style convention on the background color and font of the entire activity, you need to use another technology, theme.
First, write the theme file, which is similar to the style file and placed in the Res/values Directory: (RES/values/theme. XML)
<? XML version = "1.0" encoding = "UTF-8" ?> < Resources > < Color Name = "Custom_background_color" > # Ffffffff </ Color > < Style Name = "Rivertheme" Parent = "Android: theme. Light" > < Item Name = "Android: windowbackground" > @ Color/custom_background_color </ Item > </ Style > </ Resources >
The theme. Light of the system is inherited here. Generally, theme is inherited, so that you do not need to define the default style repeatedly.
This example defines a background color. The background color must be declared separately. You cannot directly write the color value in the item element. A syntax error is prompted.
Reference this theme in the activity specified in the manifest file:
<Activity .............
Android: theme = "@ style/rivertheme">
Theme can also be used in the application as a whole...
Reference: http://marshal.easymorse.com/archives/4111