parallax for android

How to create 3D Parallax for Android App

The parallax for android app is what take android app to another level. In this post, I am going to show you how to create your android app more attractive using Parallax effect. You can use 3D Parallax effect on your intro slider. If you don’t know about intro slider, look at my post about how to create intro slider. If you are game lover or planing to create a designer app than you should use parallax effect.

I am using a image as background image, you can choose any good background image from Google. Also I am using four object images(.png file), so this way I can perform some motion effect over background image.

I am using a parallax library that make animation work very easy. One more library that I am using is “nineoldandroids:library”. You have to write dependency in gradle file –     compile ‘com.nineoldandroids:library:2.4.0’. so lets start with coding. Below are the step I will discuss with you in this post.

you can download my image object from this drawable link. Put all images inside drawable folder of your android project.

1) Create ViewPager
2) Create FragmentPage
3) Add Gradle Dependency
4) Add Parallax lib
5) Add parallax in Activity
6) Run App on device

50 days android course

Create ViewPager

As you can see on finger slide objects are moving. So I am going to place a ViewPager in activity_main.xml to create sliding effect  on app. I hope you know about ViewPager, if not than first look at here for ViewPager.

Create FragmentPage

Now I am creating fragmentpage.xml file that will display on viewpage. In fragment pager I am placing all the four image object over the background image. You can set position of images according to your choice. I am using Relative layout as main Layout so it become easy to place images on my desirable position.

You can see that I have set background for Relative layout than I am using four image object over it. You can download my image object from this drawable link

 Add Gradle Dependency

Open project module gradle file and put this code inside dependency section.

compile ‘com.nineoldandroids:library:2.4.0’.

Add Parallax lib

open project folder and go to the folder name “Java”. Inside this folder put parallax library folder name as “parallaxViewPagerLibrary”. Download parallax lib from Here.

Add Parallax for android

now open file and define a viewpager . You have to use Fragment manager as ViewPager adapter. So create new java file name as “adapterViewPager” which is extent by FragmentStatePagerdapter .

Now create fragment java file name as “fragmentpage” and attach fragment layout xml file with this fragment java file using inflate. Below are to complete code for all java file.

Run Code

now run this code in emulator or real device. Your 3d parallax for android app is ready to use.


Login & Download source code




NOTE: You can learn both basic and advance android app development with me. Every morning I am live at TeamViewer. All the videos of live session and complete code is also available onlineClick here to learn more

Do you want to know How to create Android Game ?


Posted in andorid.

kamal bunkar

I Am Post Graduation (M.Tech. C.S.E) from VNIT, Nagpur. I Have Published Two Research Paper On International Journal. My Apps on Google Play Store- Sanyukt Parivar(Mp Police ), NOTOtag- Digital Chhindwara, The Tubby-VoiceRecognizer & More.
Contact me at

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *