January 2017
Beginner to intermediate
624 pages
22h 42m
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 listSeparatorTextViewStyle attribute in Chapter 7.
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"/> ...Read now
Unlock full access