Home » Posts tagged 'Android' (Page 2)
Tag Archives: Android
Themes and Style in Android
- A style is a collection of properties that specify the look and format for a View or window. A style can specify properties such as height, padding, font color, font size, background color, and much more. A style is defined in an XML resource that is separate from the XML that specifies the layout. Styles in Android share a similar philosophy to cascading style sheets in web design—they allow you to separate the design from the content.
- A theme is a style applied to an entire Activity or application, rather than an individual View (as in the example above). When a style is applied as a theme, every View in the Activity or application will apply each style property that it supports.
- To create a set of styles, save an XML file in the res/values/ directory of your project. The name of the XML file is arbitrary, but it must use the .xml extension and be saved in the res/values/ folder. The root node of the XML file must be. For each style to create, we need to add a<!–
element to the file with a name that uniquely identifies the style (this attribute is required). Then we need to add an element for each property of that style, with a name that declares the style property and a value to go with it (this attribute is required). The value for the can be a keyword string, a hex color, a reference to another resource type, or other value depending on the style property.
–>
- Each child of the <resources> element is converted into an application resource object at compile-time, which can be referenced by the value in the <style> element’s name attribute. A style that you want to use as an Activity or application theme is defined in XML exactly the same as a style for a View. A style can be applied as a style for a single View or as a theme for an entire Activity or application.
- We can inherit from styles that we’ve created ourselves or from styles that are built into the platform.
- The best place to find properties that apply to a specific View is the corresponding class reference, which lists all of the supported XML attributes. For example, all of the attributes listed in the table of TextView XML attributes can be used in a style definition for a TextView element (or one of its subclasses).
- There are two ways to set a style:
- To an individual View, by adding the style attribute to a View element in the XML for your layout.
- Or, to an entire Activity or application, by adding the android:theme attribute to the <activity> or<application> element in the Android manifest.
- When we apply a style to a single View in the layout, the properties defined by the style are applied only to that View. If a style is applied to a ViewGroup, the child View elements will not inherit the style properties—only the element to which we directly apply the style will apply its properties. However, we can apply a style so that it applies to all View elements—by applying the style as a theme.
- To apply a style definition as a theme, we must apply the style to an Activity or application in the Android manifest. When we do so, every View within the Activity or application will apply each property that it supports.
- To set a theme for all the activities of your application, open the AndroidManifest.xml file and edit the <application> tag to include the android:theme attribute with the style name.
- If we want a theme applied to just one Activity in our application, then we need to add the android:theme attribute to the <activity> tag instead.
- Just as Android provides other built-in resources, there are many pre-defined themes that we can use, to avoid writing them ourselves.
- A list of the standard attributes that you can use in themes can be found at R.styleable.Theme.
- 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”.
- We can also set the theme of an activity programmatically. This is done by calling setTheme() in the activity’s onCreate() method, before any call to setContentView(). Note that this approach should typically be avoided, especially from the main activities of our application, because the theme we set here may not be used for any animations the system uses to show the activity (which is done before your activity starts). The exception to this rule is if we want to set our themes dynamically, such as in the case where the application can have more than one theme.
How to create the themes for entire device
http://www.youtube.com/watch?v=o1tVMZXV92k
through google code (panda home) this is used to generate the Launcher theme and will be applied to whole device: this will help you to generate the apt and apk file of your desired theme.We can upload the icons etc and then generate the theme.
http://home.pandaapp.com:888/index.html
Some other links and this need root explorer
http://androidforums.com/android-themes/347967-tutorial-theming-walkthrough-v-1-a.html
http://androidforums.com/android-themes/347967-tutorial-theming-walkthrough-v-1-a.html#post2773967
http://androidforums.com/optimus-m-all-things-root/343299-make-your-own-themes.html
http://androidforums.com/android-themes/377669-theme-goodies.html
http://androidforums.com/android-themes/
http://androidforums.com/faqs/633037-guide-how-wip-easy-theming.html
http://kschang.hubpages.com/hub/How-to-add-themes-to-your-Android-device-complete-guide