Skip to content

Instantly share code, notes, and snippets.

@e10dokup
Last active December 23, 2015 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save e10dokup/40c4ba06b9d0bb9fbba3 to your computer and use it in GitHub Desktop.
Save e10dokup/40c4ba06b9d0bb9fbba3 to your computer and use it in GitHub Desktop.
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name="activity"
type="info.e10dokup.databindingtest.MainActivity" />
<variable
name="user"
type="info.e10dokup.databindingtest.User" />
</data>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:showIn="@layout/activity_main">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@{user.firstName}"
android:id="@+id/text_first_name"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{user.lastName}"
android:id="@+id/text_last_name"
android:layout_below="@+id/text_first_name"
android:layout_centerHorizontal="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click"
android:id="@+id/btn_click"
android:layout_below="@+id/text_last_name"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true"
app:onClickListener="@{activity.buttonClickListener}"/>
</RelativeLayout>
</layout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment