Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cardCornerRadius shows error

Tags:

android

xml

I am learning android material design but in between it keeps giving an error. Can anyone help me on this?

workspace/RecyclerCardView/res/layout/list_item_row.xml:2: error: No resource identifier found for attribute 'cardCornerRadius' in package 'com.Zybo.recyclercardview'

<android.support.v7.widget.CardView  xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
card_view:cardCornerRadius="5dp" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/img_id"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="7dp" />

    <TextView
        android:id="@+id/txt_id"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hellooo..." />
</LinearLayout>

</android.support.v7.widget.CardView>
like image 475
Ramz Avatar asked Aug 13 '15 08:08

Ramz


4 Answers

implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'

Above is sufficient.

like image 106
AlexV Avatar answered Oct 18 '22 01:10

AlexV


Add these dependencies to build.gradle.
Use the keyword implementation instead of compile as it has been deprecated

implementation 'com.android.support:cardview-v7:26.1.0' 
implementation 'com.android.support:appcompat-v7:26.1.0'

then use

app:cardCornerRadius="5dp" 

instead of

card_view:cardCornerRadius="5dp"
like image 15
Light Yagami Avatar answered Oct 18 '22 00:10

Light Yagami


This worked for me

app:cardCornerRadius="5dp"
app:cardElevation="2dp"
like image 9
RynohRR Avatar answered Oct 17 '22 23:10

RynohRR


Thanks all for trying to solve the question. At last I got the answer for my question:

  1. Import the card view and recycle view separately from sdk/extras/v7/cardview
  2. sdk/extras/v7/recycleview
  3. right click on the imported projects go to properties and check the library box.
  4. Now go the main project where you are working and add these two libraries by right clicking on the project go to properties-->android(left side)-->click add(library) (right bottom side) and the required libraries.
like image 5
Ramz Avatar answered Oct 17 '22 23:10

Ramz