I am using CardView
of support library in my android app. I tried 4-5 hours to resolve this but i could not get success.
I have added CardView
To fix this problem . first you must add cardview from the \sdk\extras\android\support
That works for me.
Support libs that contain resources other than compiled classes (like XMLs) cannot be added as just jars.
Please follow the steps described by this:
https://developer.android.com/tools/support-library/setup.html#libs-with-res
Let us now if that works.
(for intellij users)
Try this..
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_gravity="center"
android:layout_width="200dp"
android:layout_height="200dp"
card_view:cardCornerRadius="4dp">
</android.support.v7.widget.CardView>
Reference : Create Cards
Try using like this with the outer linearlayout.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
... >
<!-- A CardView that contains a TextView -->
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_gravity="center"
android:layout_width="200dp"
android:layout_height="200dp"
card_view:cardCornerRadius="4dp">
<TextView
android:id="@+id/info_text"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v7.widget.CardView>
</LinearLayout>
I had the same problem as you.
In Eclipse, when you import cardview from directory \sdk\extras\android\support\v7\cardview follow the steps that are commented in "Adding libraries with resources -> Eclipse" in the official documentation:
https://developer.android.com/intl/es/tools/support-library/setup.html#libs-with-res
Before adding cardview as library to your project, go to "Properties -> Android" of cardview project and add the android-support-v7-appcompat library. Don't forget check "IsLibrary".
Now, you can add cardview as library to your project. Clean both projects to refresh the changes.
I hope it helps you.