-
-
Save hjJunior/5af10f3362e3e06218a3b50906828700 to your computer and use it in GitHub Desktop.
Android Material Design List Item Layouts (based on http://stackoverflow.com/a/27661786/518179)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Clickable and selectableItemBackground are optional --> | |
<RelativeLayout | |
android:id="@+id/two_line_item" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="?selectableItemBackground" | |
android:clickable="true" | |
android:minHeight="72dp" | |
android:paddingEnd="?listPreferredItemPaddingRight" | |
android:paddingLeft="?listPreferredItemPaddingLeft" | |
android:paddingRight="?listPreferredItemPaddingRight" | |
android:paddingStart="?listPreferredItemPaddingLeft"> | |
<ImageView | |
android:id="@+id/primary_action" | |
android:layout_width="40dp" | |
android:layout_height="40dp" | |
android:layout_marginTop="16dp" | |
android:scaleType="centerInside" | |
android:src="@drawable/ic_primary" /> | |
<LinearLayout | |
android:id="@+id/lines_container" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_alignWithParentIfMissing="true" | |
android:layout_centerVertical="true" | |
android:layout_marginLeft="16dp" | |
android:layout_marginRight="16dp" | |
android:layout_toEndOf="@+id/primary_action" | |
android:layout_toLeftOf="@+id/secondary_action" | |
android:layout_toRightOf="@+id/primary_action" | |
android:layout_toStartOf="@+id/secondary_action" | |
android:orientation="vertical" | |
android:paddingBottom="16dp" | |
android:paddingTop="16dp"> | |
<TextView | |
android:id="@+id/first_text_view" | |
style="@style/TextAppearance.AppCompat.Body2" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:singleLine="true" | |
tools:text="First Line" /> | |
<TextView | |
android:id="@+id/second_text_view" | |
style="@style/TextAppearance.AppCompat.Body1" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:singleLine="true" | |
tools:text="Second Line" /> | |
</LinearLayout> | |
<!-- Can be replaced by a widget --> | |
<ImageView | |
android:id="@+id/secondary_action" | |
android:layout_width="40dp" | |
android:layout_height="40dp" | |
android:layout_alignParentEnd="true" | |
android:layout_alignParentRight="true" | |
android:layout_marginLeft="16dp" | |
android:layout_marginStart="16dp" | |
android:layout_marginTop="16dp" | |
android:scaleType="centerInside" | |
android:src="@drawable/ic_secondary"/> | |
</RelativeLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment