Image In Cardview With Top Radius Not Showing Corner Radius
I have recyclerView which insides cardView that has ImageView and it takes 70% height of its. So I have given corner radius to cardView. The bottom of cardView radius is shown but
Solution 1:
Try this..
<FrameLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"android:id="@+id/card_view"android:layout_width="match_parent"android:layout_height="120dp"android:layout_gravity="center"android:layout_margin="8dp"android:background="@drawable/shape"android:elevation="4dp"><android.support.v7.widget.CardViewandroid:layout_width="match_parent"android:layout_height="match_parent"android:layout_gravity="center"android:elevation="4dp"app:cardCornerRadius="8dp"><ImageViewandroid:id="@+id/thumbnaill"android:layout_width="160dp"android:layout_height="140dp"android:layout_gravity="left"android:background="@drawable/sa"android:scaleType="fitXY"
/></android.support.v7.widget.CardView></FrameLayout>
And in you Drawable make a xml shape.xml
<shapexmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle"android:padding="10dp"><!-- you can use any color you want I used here gray color--><solidandroid:color="#ffffff"/><cornersandroid:radius="8dp"/><!--<stroke android:width="0.5dp" android:color="@color/darker_gray"/>--></shape>
It will look like this...Result
Post a Comment for "Image In Cardview With Top Radius Not Showing Corner Radius"