The sum of Android system (located in \base\core\res\res\values\) contains many system-defined styles. It is recommended to choose a suitable one in it and then inherit and modify it.
1. The themes in the scale android are generally used at the form level and are used to change the form style.
1、Theme:
It means the default state, that is, if the theme does not fill in any attributes here, the default is Theme
1.1、Theme_NoDisplay
It means nothing is displayed. Compare to just running the activity but nothing is displayed.
1.2、Theme_NoTitleBar
Meaning: The background theme has no title bar style. If it is not set by default, the black background will be displayed.
1.3、Theme_NoTitleBar_Fullscreen
Meaning: The background theme has no title bar and full screen style, defaults to black background
2、Theme_Black:
It means black background under default state.
2.1、Theme_Black_NoTitleBar:
Meaning: Black background theme without title bar style
2.2、Theme_Black_NoTitleBar_Fullscreen
Meaning: The style of the black background theme without title bar and full screen
3、Theme_Light
Meaning: the background is brightened by default, which is opposite to the above-mentioned black background Theme_Black.
3.1、Theme_Light_NoTitleBar
Meaning: The style without title bar for the bright background theme, opposite to Theme_Black_NoTitleBar
3.2、Theme_Light_NoTitleBar_Fullscreen
Meaning: The style of the bright background theme without title bar and full screen is opposite to Theme_Black_NoTitleBa_Fullscreenr
4、Theme_Dialog
Meaning: Dialog style: Turn the entire activity into a dialog style and appears.
5、Theme_InputMethod
6、Theme_Panel
It means: delete all unnecessary window decorations and fill in an empty rectangular box. The scope of action is equivalent to removing all elements in the dialog, just an empty rectangular box, and this is the default style.
6.1、Theme_Light_Panel
It means: delete all unnecessary window decorations and fill in an empty rectangular box. The scope of action is equivalent to removing all elements in the dialog, just an empty rectangular box, and the default is the light style.
7、Theme_Wallpaper
Meaning: Use wallpaper as the theme, default state.
7.1、Theme_WallpaperSettings
Meaning: Use wallpaper as the theme, by default, it is used to dim the previous interface as the theme
7.2、Theme_Light_WallpaperSettings
Meaning: Use wallpaper as the theme, the default Light state is.
7.3、Theme_Wallpaper_NoTitleBar
Meaning: Use wallpaper as the theme, and there is no title bar
7.4、Theme_Wallpaper_NoTitleBar_Fullscreen
Meaning: Use wallpaper as the theme, without a title bar, and display it in full screen
8、Theme_Translucent
Meaning: In the background in a translucent state, the screen before running this activity is used as a translucent state as the style of the runtime of this activity.
8.1、Theme_Translucent_NoTitleBar
Meaning: There is no background of the title bar in the translucent state, the screen before running this activity is used as the translucent state as the style of the runtime of this activity.
8.2、Theme_Translucent_NoTitleBar_Fullscreen
Meaning: In translucent state, there is no title bar and full screen background, the screen before running this activity is used as a translucent state as the style of the activity runtime.
2. Style in android is generally used in form element sectors and is used to change the style of the control
It is understood that the properties written in the control properties are wrapped in a file! !
Style file specification:
<resources>
<style name="TextStyle">
<item name="android:textSize">14sp</item>
<item name="android:textColor">#fff</item>
</style>
</resources>
It is an XML that starts with <resources>, defines the style node, and defines each item in the style.
Quotation is also very simple, as follows:
style="@style/TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, World!" />
The above are just some simple applications of style. Here we will talk about a very practical knowledge, that is, the inheritance relationship of style. This will better simplify the workload of our code and make more use of the entire program logic. Its inheritance relationship can be implemented in two ways:
1. It is specified through the parent property
2. Specify by point number
Next, let’s give examples: the TextView that is most commonly used in our program may be the TextView, which may have many situations, such as title, text, prompts, etc. These TextViews have their common points and their differences. First we define a pass style:
<item name="android:shadowDx">-0.5</item>
<item name="android:shadowDy">1</item>
<item name="android:shadowRadius">0.5</item>
<item name="android:singleLine">true</item>
<item name="android:ellipsize">marquee</item>
</style>
The above mainly defines his shadow, single line, what should I do if it exceeds the length. Next, we define a title-level style. We also want these attributes for title, so we have to inherit it. First we use parent attribute to inherit
<item name="android:textSize">18sp</item>
<item name="android:textColor">#fff</item>
<item name="android:textStyle">bold</item>
</style>
The parent attribute follows the name of the parent class, just like the shadow of the title, font size, color and thickness, and we no longer need to define the shadow of the title. Save a lot of time. The second inheritance is the method of utilizing , using dots to inherit , we can also write the TextTitle above as follows:
<item name="android:textSize">18sp</item>
<item name="android:textColor">#fff</item>
<item name="android:textStyle">bold</item>
</style>
This will also achieve the expected results. What makes this uncomfortable is that the name grows. When we quote this style, we have to style="@style/". The more levels of inheritance, the longer the name will be.
The above is the full content of the Android development UI interface throme and style. I hope you can give you a reference and I hope you can support me more.