Chapter 24

Defining and Using Styles

Every now and then, you will find some code with a cryptic style attribute in a layout element. For example, in the chapter on threading, the following ProgressBar was presented:

<?xml version="1.0" encoding="utf-8"?> <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"   android:orientation="vertical"   android:layout_width="fill_parent"   android:layout_height="fill_parent"   >   <ProgressBarandroid:id="@+id/progress"     style="?android:attr/progressBarStyleHorizontal"     android:layout_width="fill_parent"     android:layout_height="wrap_content" /> </LinearLayout>

Something about that magic style attribute changed our ProgressBar from a normal circle to a horizontal bar.

This chapter ...

Get Beginning Android 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.