Skip to content

Instantly share code, notes, and snippets.

@venik
Created March 20, 2019 18:50
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 venik/7b57b35ce9ebb5a6bde36ddb513fd29c to your computer and use it in GitHub Desktop.
Save venik/7b57b35ce9ebb5a6bde36ddb513fd29c to your computer and use it in GitHub Desktop.
<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="android.view.View"/>
<variable
name="viewmodel"
type="com.example.gql1.viewmodels.PokemonVM"/>
</data>
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="@{() -> viewmodel.onClick()}">
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/pokeAvatar"
android:layout_width="@dimen/thumbnail_size"
android:layout_height="@dimen/thumbnail_size"
android:layout_gravity="center_vertical"
android:imageDrawable="@{viewmodel.avatar}"
android:layerType="software"/>
<TextView
android:id="@+id/pokeName"
android:text="@{viewmodel.name}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:ellipsize="end"
android:singleLine="true"
android:padding="10dp"/>
</LinearLayout>
<LinearLayout
android:id="@+id/detailsLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="@{viewmodel.showDetails ? View.VISIBLE : View.GONE}"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/detailsText"
android:text="@{viewmodel.description}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="6dp"/>
</LinearLayout>
</LinearLayout>
</layout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment