<?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android"> <data> <variable name="viewModel" type="com.example.sprout.refactor.viewmodel.RoomCreateViewModel" /> </data> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="@dimen/margin_small" android:orientation="vertical"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="ルーム名" android:text="@={viewModel.roomName}" /> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="@={viewModel.hasPass}" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="パスワード" android:text="@={viewModel.pass}" android:visibility="@{viewModel.hasPass.get() ? android.view.View.VISIBLE : android.view.View.GONE}" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="@{() -> viewModel.onClickCreate(viewModel.roomName.get(),viewModel.pass.get())}" android:text="作成" /> </LinearLayout> </layout>