Android Tutorial

(avery) #1
Android Tutorial 215

14px
italic

Here you find two common attributes in a single style and a
reference to them from the other two styles that have different
attributes. You can reference any style as a parent style; however,
you can set only one style as the style attribute of a View. Applying
the padded_italics style that is already defined makes the text 14
pixels in size, italic, red, and padded. The following is an example
of applying this style:

<TextView
style=”@style/padded_italics”
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:text=”Italic w/parent color” />


As you can see from this example, applying a style with a parent is
no different than applying a regular style. In fact, a regular style
can be used for applying to Views and used as a parent in a
different style.



Here the padded_xlarge style is set as the parent for the
green_glow style. All six attributes are then applied to any view
that this style is set to.
Free download pdf