To sum up the correct Theme method in Android, androidtheme
In AndroidManifest. the xml file contains <application android: theme = "@ style/AppTheme">, where @ style/AppTheme is the referenced res/values/styles. the theme style in xml may also be referenced by res/values-v11/styles. xml or res/values-v14/styles. xml, which is determined by the mobile phone system that runs the program. If the mobile phone system's API version is above 11, it is v11/styles. xml, and so on. In values/styles. in xml, you will find that the topic style of AppTheme is inherited from AppBaseTheme, and the parent topic of AppBaseTheme is different. You can also modify the topic from this position, this article mainly discusses how to modify this topic.
It should be noted that, as a beginner or dedicated to Theme, you 'd better remove values-v11 and values-v14 as well as values-vXX to avoid being disturbed by these Theme.
There are three sources of topics:
1) comes from the Android system
2) compatible packages (such as v7 compatible packages)
3) Write a topic by yourself.
Here we will mainly discuss the first two. We will not discuss theme writing by ourselves.
"Android:" must be added to a self-contained topic in the android system, for example, android: Theme. Black.
The topic in the v7 compatibility package does not require a prefix. Direct: Theme. AppCompat
There will be an automatic prompt when writing a topic in Android Studio, but there will be no automatic prompt in Eclipse
The solution is not to write "android: Theme. Black", but to "@ android: style/Theme. Black", so there will be a prompt.
Do not write "Theme. AppCompat", but "@ style/Theme. AppCompat"
Because style (@ android: style/Theme. black) and theme (android: Theme. black) there are still differences in the mission, so when writing in eclipse, you can write "@ android: style/Theme. black, but after writing it, remember to manually change it to "android: Theme. black"
Now let's look at some topics.
Built-in themes:
API 1:
Android: Theme root topic
Android: Theme. Black Background Black
Android: Theme. Light Background WHITE
Android: Theme. Wallpaper background with desktop Wallpaper
Android: Theme. Translucent transparent background
Android: Theme. Panel
Android: Theme. Dialog box style
API 11:
Android: Theme. Holo root topic
Android: Theme. Holo. Black Holo Black Theme
Android: Theme. Holo. Light Holo white topic
API 14:
Theme. DeviceDefault device Default Root topic
Theme. DeviceDefault. Black device default Black topic
Theme. DeviceDefault. Light device default white topic
API 21: (Android Material Design is often used on the Internet)
Theme. Material root topic
Theme. Material. Light Material white subject
Topics included in the compatible package v7:
Theme. AppCompat is compatible with the root topic of the topic.
Theme. AppCompat. Black compatible Theme Black Theme
Theme. AppCompat. Light compatible Theme white topic
Theme. AppCompat is a compatible topic. What does it mean?
That is to say, if the mobile phone API of the program is 21, it is equivalent to the Material topic. If the mobile phone API of the program is 11, it is equivalent to the Holo topic, and so on.
The Compatibility package v7 will be constantly upgraded by Google:
For example, the appcompat-v7-21.0 indicates upgrading to API 21 compatible
For example, the appcompat-v7-23.2 indicates upgrading to API 23 compatible
In eclipse, I can only see that appcompat_v7 is not followed by the API version number. How can I identify it?
Expand the res folder of the v7 project in eclipse and check whether there are folders such as values-21 and values-23. The maximum number is the API version number.
Therefore, the same v7 compatibility package may have different API version numbers.
All topics that can be applied to applications start with Theme.
Not starting with "Theme.", it is not an application topic, but used for some local controls.
For example, the ThemeOverlay topic can be used in the Toolbar Control. No further analysis is provided here.
For example, the "TextAppearance" topic can be used to set the text appearance. No further analysis is provided here.
For example, in v7, there are many themes starting with "Base", which are some parent themes and are not recommended for direct use.
More topics:
The following areInclude", For example," Dialog "indicates the style of the Dialog box.
For example, Theme. Dialog, Theme. Holo. Dialog, Theme. Material. Dialog, and Theme. AppCompat. Dialog are all Dialog box styles.
Is there such a combination?Automatic prompt.
Black
Light bright Style
Dark style
DayNight daytime Style
Wallpaper as the background
Translucent transparent background
Panel Style
Dialog box style
NoTitleBar does not have TitleBar
NoActionBar does not have ActionBar
Fullscreen full screen Style
The width of the MinWidth dialog box or ActionBar varies according to the content, rather than full screen.
WhenLarge dialog box full screen
TranslucentDecor translucent Style
NoDisplay is not displayed, that is, hidden
WithActionBar displays ActionBar on the old theme
Errors are reported when many themes are used. For example, a form must inherit AppCompactActivity, ActionBarActiivty, FragmentActivity, or width or height must be specified manually, you can also upgrade the API version to a later version, or upgrade the SDK version of the compatible package.
Try it !!!
If the statement is not well written, please criticize and correct it.