/*----------------------------------------*-Description--theme Color Configuration module Summary.*-Describe several implementations of--s1.android night mode* SS1. Modify Widget color directly: need to modify every control, too much trouble* SS2. By modifying the theme, updating the app theme requires the activity t
[Android] No resource found that matches the given name 'Theme. AppCompat. light', androidappcompatThe following error occurs when importing a project to another user during android integration:Error: Error retrieving parent for item: No resource found that matches the given name 'Theme. AppCompat. light '.Use stackove
The project often use style and theme, but never consider their differences, will only copy to copy to, and sometimes confused, in order to completely farewell confusion, now the difference between the two and use summed up, for themselves and everyone referenceI. ScopeTheme is for the form level and changes the form style.Style is for the level of the form element, changing the styles of the specified control or layoutTwo. How to useTheme1. Create a
It is believed that most people start with a white or black screen before starting the app and then entering the first interface, for example: Splashactivity. Then what is the cause of it?
The reason is that we have to change the theme of activity/application set cause, because the theme of the corresponding Windowbackground and other backgrounds are set to white or black, And when we enter th
1. First, the theme attribute is detailed:Android:theme= "@android: Style/theme.dialog"//activity displayed as dialog box modeAndroid:theme= "@android: Style/theme.notitlebar"//Do not display the application title barAndroid:theme= "@android: Style/theme.notitlebar.fullscreen"//Do not display the application title bar
about the black screenBy default, when the program starts, there is a black screen period, because the first activity loads some data, such as initializing the list data.Removal Steps1./res/values/styles.xml in Theme, add a Android:windowbackgrounds property to set the desired picture2. In Androidmanifest.xml, set theme to the first startup activity.3. Add/res/drawable-port/loading.png (if the splash screen
components, and only one, set the error message must first seterrorenabled (true), and then set the SetError ().TextinputedittextLike Textinputedittext and Textinputlayout, the design package also has a component Textinputedittext, which inherits the Appcompatedittext, which displays a small pop-up prompt with error messages on the right. Usage and textinputedittext are similar, and without setting error message elimination, re-textinputedittext output will be automatically canceled, very flexi
1. the main differences between themes and styles are as follows:
A topic cannot be used to form a single View. A topic should take effect for all the activities in the application or for the specified Activity.
The format of the theme definition should be to change the appearance format of the window, such as the window variant and window border.
2. Custom themes
Add a topic in the/res/values/my_style.xml file and define the
After searching the Internet, Android comes with theme as follows:? android:theme= "@android: Style/theme.dialog" displays an activity as a dialog box modeAndroid:theme= "@android: Style/theme.notitlebar" does not show the application title bar? android:theme= "@android: Sty
Android:theme= "@android: Style/theme.dialog": Activity is displayed as dialog box modeAndroid:theme= "@android: Style/theme.notitlebar": Do not display the application title barAndroid:theme= "@android: Style/theme.notitlebar.fullscreen": Does not display the application title bar and full screenAndroid:theme= "Theme.light": white backgroundAndroid:theme= "Theme
);
//Remove Application title bar First Note: Be sure to Setcontentview before
Requestwindowfeature (Window.feature_no_title);
//Set our defined window as the default view
Setcontentview (r.layout.float_activity);
}
}
As a final step, change the application configuration file Androidmanifest.xml to apply the style we just created to our activity as follows:XML code
activity android:name=". Floatactivitydemo " android:theme=" @style/theme.floatactivity ">
intent-filter
android:theme= "@android: Style/theme.dialog" displays an activity as a dialog box modeandroid:theme= "@android: Style/theme.notitlebar" does not display the application title barandroid:theme= "@android: Style/theme.notitlebar.fullscreen" does not display the application title bar and full screenandroid:theme= "theme.light" background is whiteandroid:theme= "The
Theme topic modification settings for Android learning notes
(1) Layout File
(2) create an xml file in values
# ACBDEC
# B0b0ff
(3) If you want to modify the default Android topic, you need to modify it in the list file.
(4) Other questions ca
1. Add 2. In 1) 2) In fact However, these two use very inconvenient, as to how to let two headings to the middle of the method has not been found, after learning to add itModify Actionmode tab layout in Android-theme
(1) Layout fileNeed to use inside the button: android:textcolor= "@color/button_selector"(2) You need to create a color folder in the Res directoryThe contents of the Button-selector file are as follows:Other files do not change, the default can beThe style and theme selector for Android learning notes
The second way to implement Android app theme is through APK. Here is a demo.1. First you must create a new apk, similar plugin, and then add a meta-data to the application of the APK androidmanifest.xml file. This is the next step to find out if it is your own plugin apk to make a mark. 2. In the apk add some pictures, also can use other (including style, etc.) here is mainly for demonstration. Define a m
The "Android registration page" blog in the Main.xml code in each component defines the attributes have a duplicate of the section, in order to avoid the tedious can be the various components duplicate properties defined into a file: res/values/Style_test.xml Source:The Main.xml file is modified as follows:Android:layout_width= "Match_parent"android:layout_height= "Match_parent"android:stretchcolumns= "1"android:background= "@drawable/bluesky"> style=
Android theme Application
Enter the text directly!
To set a topic, you must first define a custom attribute value,
Attrs. xml
Then, define the corresponding style.
Styles. xml
OK. You can use it now!
Main. xml
Of course, you also need to set it in the onCreate method of Activity when actually using it:
setTheme(R.style.Bule);
// Note that you must set the topic
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.