Skip to content

Instantly share code, notes, and snippets.

@vinothkannans
Created May 13, 2016 10:59
Show Gist options
  • Save vinothkannans/705ef49051682fe2ed33a6dd12437b90 to your computer and use it in GitHub Desktop.
Save vinothkannans/705ef49051682fe2ed33a6dd12437b90 to your computer and use it in GitHub Desktop.
Two lines list item with primary action image as per android material design guidelines
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="72dp"
android:layout_marginBottom="1dp"
android:elevation="1dp">
<ImageView
android:id="@+id/icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp" />
<TextView
android:id="@+id/topMarker"
android:layout_width="1dp"
android:layout_height="1dp"
android:layout_alignParentTop="true"
android:layout_marginLeft="72dp"
android:layout_marginTop="20dp"
android:paddingTop="11dp"
android:textSize="1dp" />
<TextView
android:id="@+id/bottomMarker"
android:layout_width="1dp"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:layout_marginLeft="72dp"
android:gravity="center"
android:padding="0dp"
android:textSize="1dp" />
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/topMarker"
android:ellipsize="end"
android:layout_marginLeft="72dp"
android:maxLines="1"
android:text="Primary text"
android:textColor="@android:color/primary_text_light"
android:textSize="16sp" />
<TextView
android:id="@+id/datetime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/bottomMarker"
android:text="Secondary text"
android:layout_marginLeft="72dp"
android:textColor="@android:color/secondary_text_light"
android:textSize="14sp" />
</RelativeLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment