January 2017
Beginner to intermediate
624 pages
22h 42m
English
With data binding, you can declare data objects within your layout file:
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="crime"
type="com.bignerdranch.android.criminalintent.Crime"/>
</data>
...
</layout>
And then use values from those objects directly in your layout file by using the binding mustache operator – @{}:
<CheckBox
android:id="@+id/list_item_crime_solved_check_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:checked="@{crime.isSolved()}"
android:padding="4dp"/>
In an object diagram, that would look like Figure 20.7:
Figure 20.7 The ...
Read now
Unlock full access