July 2015
Beginner to intermediate
600 pages
18h 59m
English
Once attributes are declared in your theme, you can access them in XML or in code.
To access a theme attribute in XML, you use the notation that you saw on the divider attribute in Chapter 17.
When referencing a concrete value in XML, such as a color, you use the @ notation.
@color/gray points to a specific resource.
When referencing a resource in the theme, you use the ? notation.
<Button xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/list_item_sound_button"
android:layout_width="match_parent"
android:layout_height="120dp"
android:background="?attr/colorAccent"
tools:text="Sound name"/>
The ? notation ...
Read now
Unlock full access