RoundCorner Image inside CardView

325 views Asked by At

I using CardView from support library I have a RoundCorner Image inside that But radius not apply to Image is it Bug with Cardview or Problem with my XML ? ( I used this RoundCorner Image library many times and works fine ) I test this on nexus 5 android L and emulator nexus One android 4.1.1

Here is my XML :

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/tools"
    xmlns:card_view="http://schemas.android.com/apk/res/com.rahavardnovin.Sada"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.CardView
        android:id="@+id/card_view"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        card_view:cardCornerRadius="@dimen/radius_medium"
        card_view:cardElevation="@dimen/cardview_default_elevation"
        card_view:cardUseCompatPadding="true">

        <!-- date  -->
        <com.rahavardnovin.Sada.ui.customui.PersianTextView
            android:id="@+id/newsDate"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/global_padding"
            android:layout_marginTop="3dp"
            android:textSize="@dimen/textsize_smallest" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:layout_marginBottom="@dimen/global_padding"
            android:layout_marginLeft="@dimen/global_padding"
            android:layout_marginRight="@dimen/global_padding"
            android:layout_marginTop="@dimen/actionbar_items_size"
            android:gravity="right"
            android:orientation="horizontal">

            <com.makeramen.RoundedImageView
                android:id="@+id/newsImage"
                android:layout_width="@dimen/album_photo_width"
                android:layout_height="@dimen/album_photo_height"
                android:src="@drawable/avatar_agent"
                app:riv_corner_radius="4dp" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="right"
                android:layout_marginBottom="@dimen/global_padding_small"
                android:orientation="vertical"
                android:paddingRight="10dp">


                <com.rahavardnovin.Sada.ui.customui.PersianTextView
                    android:id="@+id/newsTitle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="right"
                    android:ellipsize="end"
                    android:textColor="@color/black_dark"
                    android:textSize="@dimen/textsize_large" />

                <com.rahavardnovin.Sada.ui.customui.PersianTextView
                    android:id="@+id/newsContent"
                    style="@style/Textview.Gray40"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="right"
                    android:ellipsize="end"
                    android:maxLines="4"
                    android:textSize="@dimen/abc_text_size_button_material" />
            </LinearLayout>

        </LinearLayout>

    </android.support.v7.widget.CardView>
</RelativeLayout>
1

There are 1 answers

0
Blackbelt On BEST ANSWER

the xml namespace you are using for app:riv_corner_radius is wrong. It should be

xmlns:app="http://schemas.android.com/apk/res-auto"

and not

xmlns:app="http://schemas.android.com/tools"