Skip to content

Instantly share code, notes, and snippets.

@vvkirillov
Created November 7, 2015 18:37
Show Gist options
  • Save vvkirillov/371613cf8a649f725c15 to your computer and use it in GitHub Desktop.
Save vvkirillov/371613cf8a649f725c15 to your computer and use it in GitHub Desktop.
Simple Android list view item layout with left aligned image, bold header, message and selectable checkbox
<?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="88dp"
android:minHeight="88dp">
<ImageView
android:id="@+id/img_thumb"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
/>
<TextView
android:id="@+id/txtNoteText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/img_thumb"
android:layout_toRightOf="@id/img_thumb"
style="@style/NoteEntryMessage"
android:text="sample text"/>
<TextView
android:id="@+id/txtDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/img_thumb"
android:layout_toEndOf="@id/img_thumb"
android:layout_alignParentBottom="true"
style="@style/NoteEntryDate"
android:text="sample date"/>
<!-- Focusable item must not be focusable to make listview item clickable-->
<CheckBox
android:id="@+id/chkNote"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="16dp"
android:layout_centerVertical="true"
android:focusable="false"
/>
</RelativeLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment