how do you make the design with cardview?

Hope the following code helps you ,

<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <androidx.constraintlayout.widget.Guideline
            android:id="@+id/guideline"
            android:layout_width="1dp"
            android:layout_height="match_parent"
            android:orientation="vertical"
            app:layout_constraintGuide_percent=".8"/>
        
        <ImageView
            android:id="@+id/image"
            app:layout_constraintRight_toLeftOf="@+id/guideline"
            app:layout_constraintLeft_toLeftOf="parent"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:scaleType="centerCrop"
            app:layout_constraintTop_toTopOf="parent" />
        

        <LinearLayout
            android:id="@+id/actionLayout"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:orientation="vertical"
            app:layout_constraintLeft_toRightOf="@+id/guideline"
            app:layout_constraintRight_toRightOf="parent" >

            <Button
                android:id="@+id/likeButton"
                style="?attr/borderlessButtonStyle"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="100" />

            <Button
                android:id="@+id/disLikeButton"
                style="?attr/borderlessButtonStyle"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="100" />

            <Button
                android:id="@+id/optionButton"
                style="?attr/borderlessButtonStyle"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                app:iconGravity="end" />

        </LinearLayout>
    </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top