Last active
February 2, 2019 02:12
-
-
Save eugenebrusov/7aaf80381c60f3b1d387b2ecec602a65 to your computer and use it in GitHub Desktop.
CardView - avatar, media 16:9, supporting text and action buttons
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
<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"> | |
<ImageView | |
android:id="@+id/avatar_image" | |
android:layout_width="48dp" | |
android:layout_height="48dp" | |
android:layout_marginTop="12dp" | |
android:layout_marginStart="12dp" | |
android:padding="4dp" | |
android:scaleType="centerCrop" | |
app:srcCompat="@drawable/ic_avatar_40dp" | |
app:layout_constraintTop_toTopOf="parent" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintBottom_toTopOf="@+id/media_image" | |
app:layout_constraintVertical_chainStyle="packed" /> | |
<TextView | |
android:id="@+id/title_text" | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="4dp" | |
android:layout_marginStart="12dp" | |
android:layout_marginEnd="16dp" | |
android:textAppearance="@style/TextAppearance.AppCompat.Body2" | |
android:textColor="#DE000000" | |
app:layout_constraintTop_toTopOf="@+id/avatar_image" | |
app:layout_constraintStart_toEndOf="@+id/avatar_image" | |
app:layout_constraintEnd_toEndOf="parent" /> | |
<TextView | |
android:id="@+id/subtitle_text" | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" | |
android:layout_marginStart="12dp" | |
android:layout_marginEnd="16dp" | |
android:layout_marginBottom="4dp" | |
android:textAppearance="@style/TextAppearance.AppCompat.Body2" | |
android:textColor="#8A000000" | |
app:layout_constraintStart_toEndOf="@+id/avatar_image" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintBottom_toBottomOf="@+id/avatar_image" /> | |
<ImageView | |
android:id="@+id/media_image" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
android:layout_marginTop="12dp" | |
android:scaleType="centerCrop" | |
app:layout_constraintDimensionRatio="H,16:9" | |
app:layout_constraintTop_toBottomOf="@+id/avatar_image" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintBottom_toTopOf="@+id/supporting_text"/> | |
<TextView | |
android:id="@+id/supporting_text" | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="16dp" | |
android:layout_marginStart="16dp" | |
android:layout_marginEnd="16dp" | |
android:lineSpacingExtra="8dp" | |
android:textAppearance="@style/TextAppearance.AppCompat.Body1" | |
android:textColor="#DE000000" | |
app:layout_constraintTop_toBottomOf="@+id/media_image" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintBottom_toTopOf="@+id/action_button_1"/> | |
<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_marginTop="16dp" | |
android:layout_marginStart="8dp" | |
android:minWidth="0dp" | |
android:paddingStart="8dp" | |
android:paddingEnd="8dp" | |
android:textColor="#DE000000" | |
app:layout_constraintTop_toBottomOf="@+id/supporting_text" | |
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> |
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
<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
android:width="40dp" | |
android:height="40dp" | |
android:viewportWidth="40.0" | |
android:viewportHeight="40.0"> | |
<path | |
android:pathData="M20,20m-20,0a20,20 0,1 1,40 0a20,20 0,1 1,-40 0" | |
android:fillColor="@android:color/darker_gray" /> | |
</vector> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment