Improve view holder recipe layout

This commit is contained in:
Kirill Kamakin
2021-11-23 20:17:24 +03:00
parent 5639fe4517
commit 54753f6ee9
2 changed files with 18 additions and 9 deletions

View File

@@ -4,7 +4,10 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_small">
android:layout_marginVertical="7dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="19dp"
app:cardElevation="8dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@@ -14,23 +17,30 @@
android:id="@+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_small"
android:gravity="center"
android:layout_marginTop="9dp"
android:layout_marginBottom="5dp"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="?textAppearanceHeadline6"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="@+id/image"
app:layout_constraintStart_toStartOf="@+id/image"
app:layout_constraintTop_toBottomOf="@+id/image"
tools:text="A delicious cake" />
<ImageView
android:id="@+id/image"
android:layout_width="@dimen/width_view_holder_recipe_image"
android:layout_width="300dp"
android:layout_height="@dimen/height_view_holder_recipe_image"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="13dp"
android:contentDescription="@string/content_description_view_holder_recipe_image"
app:layout_constraintBottom_toTopOf="@+id/name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="@tools:sample/backgrounds/scenic" />
app:layout_constraintVertical_chainStyle="packed"
tools:srcCompat="@drawable/placeholder_recipe" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>

View File

@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="margin_small">8dp</dimen>
<dimen name="width_view_holder_recipe_image">360dp</dimen>
<dimen name="height_view_holder_recipe_image">180dp</dimen>
<dimen name="height_view_holder_recipe_image">182dp</dimen>
<dimen name="fragment_recipe_info_image_height">@dimen/height_view_holder_recipe_image</dimen>
<dimen name="bottom_padding_instructions_list_fragment_recipe_info">30dp</dimen>
<dimen name="main_activity_toolbar_corner_radius">32dp</dimen>