Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<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
You can’t perform that action at this time.