| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| Copyright (C) 2014 The Android Open Source Project |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <layout xmlns:bind="http://schemas.android.com/apk/res-auto" |
| xmlns:android="http://schemas.android.com/apk/res/android" |
| > |
| <data> |
| <variable name="user" type="com.android.example.bindingdemo.vo.User"/> |
| <variable name="clickListener" type="android.view.View.OnClickListener"/> |
| </data> |
| <LinearLayout |
| android:orientation="horizontal" android:layout_width="wrap_content" |
| android:id="@+id/root" |
| android:focusable="true" |
| android:gravity="center_vertical" |
| bind:onClickListener="@{clickListener}" |
| android:layout_height="match_parent"> |
| <!-- |
| Note: The "Unknown attribute android:backgroundResource error below is not |
| intentional; it's included in this golden file because that part is not yet |
| working and the test is checking that there are no *other* errors, such |
| as warnings on the above layout, data or variable tags |
| --> |
| <ImageView |
| android:id="@+id/user_photo" |
| <warning descr="Unknown attribute android:backgroundResource">android:backgroundResource</warning>="@{user.photoResource}" |
| android:scaleType="fitCenter" |
| android:layout_width="20dp" |
| android:layout_height="20dp" /> |
| |
| <TextView |
| android:layout_marginLeft="20dp" |
| android:id="@+id/fullname" |
| android:gravity="center" |
| android:text='@{user.name.substring(0,1).toUpperCase() + "." + user.lastName}' |
| android:layout_width="wrap_content" |
| android:layout_height="match_parent" /> |
| </LinearLayout> |
| </layout> |