I saw material design guidelines regarding but it little confusion ,while I design my card having Image on left and some text on right of Image.But I did n't satisfy whether it is according to guide line or not ...pls check and tell. and also I want my dummy text paragraph justify.
here is my code :-
<android.support.v7.widget.CardView
style="@style/MyCardViewStyle"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<ImageView
android:id="@+id/appImage"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_marginLeft="16dp"
android:background="@drawable/video"
android:scaleType="centerCrop"
tools:ignore="ContentDescription"/>
<TextView
android:id="@+id/headingText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/appImage"
android:paddingLeft="16sp"
android:paddingRight="16dp"
android:text="Title"
android:textColor="#000"
android:textSize="18sp"
tools:ignore="RtlHardcoded"/>
<TextView
android:id="@+id/subHeaderText"
style="@style/Base.TextAppearance.AppCompat.Subhead"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/headingText"
android:layout_toRightOf="@+id/appImage"
android:paddingLeft="16dp"
android:text="SubTiltle"
android:paddingRight="16dp"
android:textColor="#000"
android:textSize="15sp"/>
<TextView
android:id="@+id/subHeadingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/subHeaderText"
android:layout_toRightOf="@+id/appImage"
android:gravity="left"
android:lines="5"
android:maxLines="5"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:text="@string/stories_detail"
android:textColor="#737078"
android:textSize="14sp"/>
<Button
android:id="@+id/getDealBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/subHeadingText"
android:background="@drawable/get_deal_button"
android:elevation="2dp"
android:textAllCaps="true"
android:textColor="#FFFF"
android:textSize="14sp"
android:textStyle="bold"/>
</RelativeLayout>
and here is my cardview looks like:-
CardView is a new widget in Android that can be used to display any sort of data by providing a rounded corner layout along with a specific elevation. CardView is the view that can display views on top of each other. The main usage of CardView is that it helps to give a rich feel and look to the UI design.
With the help of CardView, we can add radius and elevation to our items of RecyclerView. CardView gives a rich look and feels to our list of data. RecyclerView: RecyclerView is an extended version of ListView. in RecyclerView we can load a large amount of data and items of RecyclerView can have a custom design.
MaterialCardView is a customizable component based on CardView from the Android Support Library. MaterialCardView provides all of the features of CardView , but adds attributes for customizing the stroke and uses an updated Material style by default.
Here's the link to GitHub project with CardView layouts implemented in compliance with Material Design guidelines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With