Last active
October 11, 2017 13:57
-
-
Save eugenebrusov/e2a8dce38928d232686e5e0152a8864c to your computer and use it in GitHub Desktop.
CardView - media 16:9 and supporting text
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/media_image" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
android:scaleType="centerCrop" | |
app:layout_constraintDimensionRatio="H,16:9" | |
app:layout_constraintTop_toTopOf="parent" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintBottom_toTopOf="@+id/supporting_text" | |
app:layout_constraintVertical_chainStyle="packed" /> | |
<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:layout_marginBottom="16dp" | |
android:textAppearance="@style/TextAppearance.AppCompat.Body1" | |
android:textColor="#DE000000" | |
android:lineSpacingExtra="8dp" | |
app:layout_constraintTop_toBottomOf="@+id/media_image" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintBottom_toBottomOf="parent"/> | |
</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