Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding all available styles defined by android platform themes

In several android styling tutorials parent style elements are used that i can not find in the android.R.style.* styles (http://developer.android.com/reference/android/R.style.html).

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

<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? Is it possible to list all available parent styles?

Thanks.

like image 796
Moritz Avatar asked Jul 03 '11 10:07

Moritz


People also ask

Where is style defined in Android?

Defining Styles A style is defined in an XML resource that is separate from the XML that specifies the layout. This XML file resides under res/values/ directory of your project and will have <resources> as the root node which is mandatory for the style file.

What is styles and themes in Android?

A style is a collection of attributes that specify the appearance for a single View . A style can specify attributes such as font color, font size, background color, and much more. A theme is a collection of attributes that's applied to an entire app, activity, or view hierarchy—not just an individual view.

How do I find styles in XML?

xml file in the new Android Studio. Goto your project file view: Res>Values>Themes folder. Open themes. xml file change actionbar.

Can we define themes in Android manifest?

Just like styles, themes are also declared in XML <style> elements, and are referenced in the same manner. The difference is that you add a theme to an entire application or activity, via the <application> and <activity> elements in the Android Manifest — themes cannot be applied to individual Views.


1 Answers

As stated in the "Applying Styles and Themes" article:

The Android platform provides a large collection of styles and themes that you can use in your applications. You can find a reference of all 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 the Theme_NoTitleBar theme with "@android:style/Theme.NoTitleBar".

The R.style reference, however, is not well documented and does not thoroughly describe the styles, so viewing the actual source code for these styles and themes will give you a better understanding of what style properties each one provides. For a better reference to the Android styles and themes, see the following source code:

  • Android Styles (styles.xml)
  • Android Themes (themes.xml)

These files will help you learn through example. For instance, in the Android themes source code, you'll find a declaration for <style name="Theme.Dialog">. In this definition, you'll see all of the properties that are used to style dialogs that are used by the Android framework.

like image 190
Idolon Avatar answered Sep 21 '22 20:09

Idolon