Confused in v4 and v13 support library

I am creating a new app with min sdk verrsion = 15, so I don't want to use the v4 support library. Now in my application I want to use scrollable tabs, so I need to view the pager for this. Now in my xml when I use something like this I get the error

XMl Code

<android.support.v13.view.ViewPager
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android" /> 

      

But this code works fine with v4 support library.

  • Now why am I not using v13.view.pager ????
  • And if I use v4.view.pager it matches the other fragments as I am not using v4.support.fragments
+3


source to share


2 answers


Now why am I not using v13.view.pager?

Because there is no such class. ViewPager

- android.support.v4.view.ViewPager

. It doesn't matter if you get ViewPager

from support-v4

or support-v13

.



And if I use v4.view.pager it matches the other fragments as I am not using v4.support.fragments

Useandroid.support.v13.app.FragmentPagerAdapter

. The library support-v13

offers v13

releases FragmentPagerAdapter

and FragmentStatePagerAdapter

that work with native API Level 11+ snippets.

+10


source


The reason you can't use android.support.v13.view.ViewPager

it is because it doesn't exist. If you find the ViewPager and click "Link" in the sidebar, you can specify which one ViewPager

is Support v4 based on its package name android.support.v4.view.ViewPager

. If you are looking for the v13 pod version android.support.v13.view

, you will see that no such package exists. Conversely, android.support.v7.view

it does exist , but it does not contain a class ViewPager

.



AFAIK, the documentation that says ViewPager

to use snippets from the support library is not required. I've only used them with snippets from the v4 support library, but that doesn't mean they won't work with regular snippets.

+2


source







All Articles