How to add RecyclerView to xml in android Lollipop

I updated my Android SDK with Android 5.0 (API 21); I also updated the platform tools and build tools.

I get an error The following classes could not be found: - android.support.v7.widget.RecyclerView (Fix Build Path, Edit XML, Create Class)after adding RecycleView to the xml file layout.

My xml file layout is as follows:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.androidlintro.MainActivity" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

  <android.support.v7.widget.RecyclerView
    android:id="@+id/my_recycler_view"
    android:scrollbars="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

</RelativeLayout>

can someone tell me what is going wrong. Why am I getting this error, even after downloading the full set of software (new SDKs, build tools, platform tools, etc.).

Note. I am using the eclipse IDE

+4
source share
3 answers

Make sure your Android Support Library is included in your project.

Eclipse: Project → Properties → Android

Android .

.

0

ECLIPSE

, : Android- sdk Android Support Library.

.aar

X:\Android-SDK\Extras\Android\m2repository\\Android\\recyclerview-v7\21.0.0

.zip , , classes.jar, - , "RecyclerView_v7.jar". .jar . , , eclipse, ( , ).

0

Android Studio:

  • : → ... →

  • "+" "1 "

  • "com.android.support:recyclerview"

  • . ""

  • Gradle , .

0

All Articles