Its very hard to describe my problem but I'll do my best <<
when I want to make a ViewPager in MainActivity , I go to xml then :
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/viewPager"
/>
then I make an Adapter
public class MyAdapter extends FragmentPagerAdapter
here , I need to import
android.support.v13.app.FragmentPagerAdapter;
the QUESTION is ;
is there any problem when I use v4 , v13 on one application
note : I add the v13 library and make it as (provided)
Edit: There shouldn't be a problem using both, just don't set it as provided. Use compile as the classes are not provided by the system.
On one hand you can use both v4 and v13 support packages . Sometimes you have to.
For example android.support.v13.app.FragmentPagerAdapter
and android.support.v4.app.FragmentPagerAdapter
are similar but not identical : they don't use the same kind of fragments (native android.app.Fragment
vs support android.support.v4.app.Fragment
).
So if you want to use a ViewPager
with native fragment you have to extend the v13 FragmentPagerAdapter
and set it on the ViewPager
(v4, there is only one). Of course this will only work on v13+ devices.
On the other hand you don't have to declare both library : the v13 support lib includes the v4, adding something like
compile "com.android.support:support-v13:23.1.1"
in your build.gradle
gives you access to both v4 an v13 support classes.
By the way, see Fragment or Support Fragment for more details about native vs support fragments.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.