Search for all available styles defined by Android platform themes

Several style books for Android use parent-style elements that I cannot find in android.R.style styles. * ( http://developer.android.com/reference/android/R.style.html ).

A few examples from the article http://android-developers.blogspot.com/2011/04/customizing-action-bar.html . Nick uses parent styles, for example:

<style name="MyDropDownNav" parent="android:style/Widget.Holo.Light.Spinner.DropDown.ActionBar"> ... </style> 

or

 <style name="MyActionBarTabStyle" parent="android:style/Widget.Holo.Light.ActionBarView_TabView"> ... </style> 

Where do these parent styles come from? Can I list all the available parent styles?

Thank.

+42
android styles themes
Jul 03 '11 at 10:15
source share
4 answers

As stated in "Applying Styles and Themes" :

The Android platform provides a large collection of styles and themes that you can use in your applications. You can find a link to all the available styles in the R.style class. To use the styles listed here, replace all underscores in the style name with a period. For example, you can apply Theme_NoTitleBar theme with "@android:style/Theme.NoTitleBar" .

The R.style link, however, is poorly documented and does not carefully describe the styles, so look at the actual source code for these styles and themes to help you better understand what each one provides. For a better link to Android Styles and Themes, see the following source code:

These files will help you learn by example. For example, in Source Code for Android, you will find an ad for <style name="Theme.Dialog"> . In this definition, you will see all the properties that are used for the dialog styles that the Android framework uses.

+64
Aug 22 2018-11-11T00:
source share

For "android: style / Widget.Holo.Light.ActionBarView_TabView" see: http://developer.android.com/reference/android/R.style.html#Widget_Holo_Light_ActionBar_TabView ... and note the API level that was introduced to!

For "android: style / Widget.Holo.Light.Spinner.DropDown.ActionBar" try: http://developer.android.com/reference/android/R.style.html#Widget_Holo_Light_DropDownItem_Spinner

The latter - this is just my best guess - I cannot make the list actually fall.

+3
Oct 20 2018-11-11T00:
source share

Parent attribute is optional when creating your own themes or styles . Basically, Parent attributes are used to inherit styles that are already defined in the platform itself.

If we want to inherit a theme or style and overwrite some functions, we can use the Parent attribute.

Here is the link for the entire available styles platform.

And one more tip:

If you want to inherit your own style that you created yourself, then follow this example to inherit.

  <style name="MyDropDownNav.Red"> <item name="android:textColor">#FF0000</item> </style> 
+3
Jan 30 '12 at 10:38
source share

Here's the Official Google Documentation for Default List Themes and Styles Google Android Documentation

You can find it here in this documentation.

I know that the answer to the above question ends here, still giving way to implementation, as it will be useful for beginners.

How to implement them

This is what I got from themes.xml

 <style name="Theme.NoTitleBar"> <item name="android:windowNoTitle">true</item> </style> 

Now to implement it in my project

I need to add the following line to my Styles.xml file

 <style name="AppTheme" parent="android:Theme.NoTitleBar" /> 

In this, I create my own theme called " AppTheme ", which will inherit its properties from already defined them by google . so i mention it in parent

By learning themes.xml , Styles.xml will not only help to get the list of the already defined themes and styles, but also help novices to have an idea how to create themes.

Since the theme that I mention here in parent is already defined by android, so we will use it by specifying the name android: in the name of the theme.

If you want to inherit your created theme , then

 <style name="Theme2" parent="AppTheme"> <item name="android:windowNoTitle">true</item> <item name="android:windowFullscreen">true</item> <item name="android:windowContentOverlay">@null</item> </style> 

then just specify a style name to the parent , here I use AppTheme as the parent theme for theme2

+2
May 6 '13 at 5:29
source share



All Articles