Skip to content

Instantly share code, notes, and snippets.

@eugenebrusov
Last active September 14, 2017 09:02
Show Gist options
  • Save eugenebrusov/e4bde15b8d2f985fc439861ee3532f57 to your computer and use it in GitHub Desktop.
Save eugenebrusov/e4bde15b8d2f985fc439861ee3532f57 to your computer and use it in GitHub Desktop.
CardView - media 1x, primary text, subtext and actions
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/CardView.Light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp">
<android.support.constraint.ConstraintLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/primary_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:textColor="#DE000000"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/media_image" />
<TextView
android:id="@+id/sub_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="#8A000000"
app:layout_constraintTop_toBottomOf="@+id/primary_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/media_image" />
<ImageView
android:id="@+id/media_image"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:id="@+id/action_button_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:minWidth="0dp"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:textColor="#DE000000"
app:layout_constraintTop_toBottomOf="@+id/media_image"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:id="@+id/action_button_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:minWidth="0dp"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:textColor="#DE000000"
app:layout_constraintTop_toTopOf="@+id/action_button_1"
app:layout_constraintStart_toEndOf="@+id/action_button_1" />
</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.CardView>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment