Can ViewPager and PagerAdapter be used without android-support-v4.jar library?

android-support-v4.jar is 750KB in size, that's a lot and I only need to use ViewPager and PageAdapter.

My application is only 50KB in size, which is huge if I use the support library.

It is possible to use ViewPager and PagerAdapter without using this .jar library?

thank

+3


source to share


2 answers


No, these components are still part of the support library. From the documentation:



This tutorial shows how to make screen slides using the ViewPager provided by the support library. ViewPagers can animate screen slides automatically.

+4


source


You can check out and modify any view, widget or other component from the support library. Look in your sdk directory for sources. If you haven't downloaded the sources yet, you can use Android SDK Manager to download. Then you can simply copy the relevant java files (in this case, ViewPager.java and PagerAdapter.java and dependencies) into your project, or better yet, create new packages for different purposes.

I did this for DrawerLayout to save space. Received 900 kB. Lost a couple of hours and had to redo the work for each new version of the API. In this case, it's worth it.



Read about ProGuard and DexGuard.

+1


source







All Articles