[[activity_main.xml]]
@DIV
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bind="http://schemas.android.com/apk/res-auto">
<data>
<variable name="user" type="sample.lightbox.myapplication.User"/>
<variable name="item" type="sample.lightbox.myapplication.Item"/>
</data>
<ViewSwitcher
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/viewSwitcher">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/buttonFirebase"
android:text="@string/button_2"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/buttonSetValue"
android:text="@string/button_1"/>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listView"/>
</LinearLayout>
<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
@c:green(layout="@layout/myitem_entry")
@c:red(bind:user="@{user}"
bind:item="@{item}")/>
</ViewSwitcher>
</layout>
@END
[[myitem.xml]] ▼ ListView 用の画面定義
@DIV
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable name="item" type="sample.lightbox.myapplication.Item"/>
</data>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<TextView
@c:red(android:text="@{item.title}")
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView3"/>
<TextView
@c:red(android:text="@{item.text}")
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/text1"
/>
</LinearLayout>
</layout>
@END
[[myitem_entry.xml]] ▼ ViewSwitcher の次画面
@DIV
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable name="user" type="sample.lightbox.myapplication.User"/>
<variable name="item" type="sample.lightbox.myapplication.Item"/>
</data>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="26dp"
@c:red(android:text="@{user.firstName}")
android:id="@+id/textView"/>
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="26dp"
@c:red(android:text="@{user.lastName}")
android:id="@+id/textView2"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:text="@string/button_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/buttonBack"/>
<Button
android:text="@string/button_4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/buttonUpdate"
android:layout_weight="1"/>
</LinearLayout>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
@c:red(android:text="@{item.title}")
android:ems="10"
android:id="@+id/editTextName"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
@c:red(android:text="@{item.text}")
android:ems="10"
android:id="@+id/editTextFuri"/>
</LinearLayout>
</layout>
@END |