<?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"> <data> <import type="java.util.Map"/> <import type="java.util.List"/> <variable name="list" type="List<String>" /> <variable name="index" type="Integer" /> <variable name="user" type="com.bw.day01.User" /> <variable name="view" type="android.view.View" /> <variable name="presenter" type="com.bw.day01.Presenter" /> <variable name="userinfo" type="com.bw.day01.UserInfo" /> <variable name="map" type="Map<String,Object>"/> <variable name="key" type="String"/> </data> <LinearLayout android:layout_width="match_parent" android:orientation="vertical" android:layout_height="match_parent" tools:context=".MainActivity2"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{user.name}" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{String.valueOf(user.age)}" android:visibility="@{user.age>20?view.GONE:view.VISIBLE}" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/et_text" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{etText.text}" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{list[index]}" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{String.valueOf(map.get(key))}" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="事件绑定" android:onClick="@{()->presenter.OnSave()}" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{userinfo.name}" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{presenter.field}" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="可观察对象" android:onClick="@{()->presenter.OnSave2(userinfo)}" /> </LinearLayout> </layout>
Banding运用
最新推荐文章于 2024-07-27 17:56:15 发布