RecyclerView: androidx.recyclerview.widget.RecyclerView vs android.support.v7.widget.RecyclerView

Nathan Sokalski 4,111 Reputation points
2021-03-10T20:36:51.2+00:00

I am working on adding a RecyclerView to my Xamarin.Android app. I want to use the most current version of any View(s) involved, but I am not sure which of the following to use:

androidx.recyclerview.widget.RecyclerView
android.support.v7.widget.RecyclerView

Visual Studio 2019's Intellisense gives me the first one, but most of the stuff I have found online use the second. Which one should I use, are there any significant differences, and where can I find info about the first one? Thanks.

Developer technologies .NET Xamarin
0 comments No comments
{count} votes

Accepted answer
  1. JessieZhang-MSFT 7,716 Reputation points Microsoft External Staff
    2021-03-11T03:18:00.15+00:00

    Hello,

    Welcome to our Microsoft Q&A platform!

    Before android 10, we use the second one: android. Support. V7. Widget. RecyclerView, and since Android10 version, what we use is the first one: androidx.recyclerview.widget.RecyclerView.

    Visual Studio 2019's Intellisense gives me the first one, but most of the stuff I have found online use the second.

    Your visual studio should have used the latest one in default.If you try to set Target Framework to Android 9.0(Pie), there should some error tips in your output window.
    We recommend using the latest version(androidx.recyclerview.widget.RecyclerView), because it works with Android low as well as Android10 and higher.

    And if we use the android.support.v7.widget.RecyclerView, we can migrate to androidx by AndroidX Migrator, for more details about this, we can check: https://learn.microsoft.com/en-us/xamarin/android/platform/androidx#migration-tooling

    where can I find info about the first one?

    RecyclerView from the first(androidx.recyclerview.widget.RecyclerView) is used the same way as before, except for a different namespace.

    For more about AndroidX , you can check document : https://developer.android.com/jetpack/androidx

    Best Regards,

    Jessie Zhang

    ---
    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.