I use Eclipse and I'm trying to create an application using the new support-library-v7:21.+
from Lollipop.
support-library-v7
project-properties
of support library the line: target=android-21
with 21 targetAfter all i still got the invalid R
declaration. I restarted Eclipse and then, after re-importing the library, seem went! I created a Tolbar
and a NavigationDrawer
as well without problem - it works.
Now, i would like to put a CardView
in my ListView
items:
<?xml version="1.0" encoding="utf-8"?>
<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/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/codename"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/versione"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/timestamp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</android.support.v7.widget.CardView>
</LinearLayout>
well, first error: No resource identifier found for attribute 'cardCornerRadius'
.
I tried to delete the attribute, restart the application but I get a the following crash:
java.lang.RuntimeException: Binary XML file line #2: You must supply a layout_width attribute.
I don't understand what the problem is.
Adding the library
Gradle
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:cardview-v7:22.0.0'
Eclipse
Using android.support.v7.widget.CardView in my project (Eclipse)
Proper LinearLayout
As the error said, a LinearLayout
needs a layout_width
and a layout_heighth
. Always.
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