Search code examples
androidbackwards-compatibility

V4/V13 support lib : Fragment work, ViewPager does not?


Testing other components in android support library,

On device classLoader can't find ViewPager however it can find other support components FragmentActivity, Fragments etc . ( using V4 as well as V13, gives same result)

What's special with ViewPager ? Does it depends on another support components to work ? (Like Fragment needs FragmentActivity)

NOTE: I think I'm properly exporting support library as dependency, else Fragment would also not have worked.


Solution

  • You should reference it like this:

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />
    

    <v4support:ViewPager> is not correct. you need the whole package name in the xml.