Would recyclerview work on an android device with

2020-05-02 10:50发布

TO display a list of items I am using the latest RecyclerView in my app. I want to know would it only work on devices having android 5.0 or would it on work on lower versions as well ?

1条回答
再贱就再见
2楼-- · 2020-05-02 11:20

Yes, it's backwards-compatible, assuming you include the support library for RecyclerView v7 in your application's build.gradle file:

Make sure you have downloaded the Android Support Repository using the SDK Manager.

  1. Open the build.gradle file for your application.

  2. Add the support library feature project identifier to the dependencies section just like this:

dependencies {
     ...
     compile "com.android.support:recyclerview-v7:21.0.0.+" 
}

That one will work down as low as Android 2.1 (API level 7), hence the name v7

查看更多
登录 后发表回答