Adding ViewPager inside another ViewPager <p><img src="https://i.stack.imgur.com/SrvvR.jpg" alt="enter image description here"></p> <p>I'm creating an activity showing some photos with ViewPager. And I want to add another little ViewPager into any page of main ViewPager. When I swipe little ViewPager main ViewPager swipes. I want main ViewPager not to swipe.</p> <p>How can I do it?</p> <p>Note: I add all the elements by programmatically.</p> <pre><code> RelativeLayout RelLay=(RelativeLayout) viewPager.findViewById(arg0); //main ViewPager page final ViewPager vpager=new ViewPager(getBaseContext()); ArrayList&lt;String&gt; childImages=new ArrayList&lt;String&gt;(); childImages.add("/storage/sdcard0/Folder/1.jpg"); childImages.add("/storage/sdcard0/Folder/2.jpg"); childImages.add("/storage/sdcard0/Folder/3.jpg"); childImages.add("/storage/sdcard0/Folder/4.jpg"); childImages.add("/storage/sdcard0/Folder/5.jpg"); ImageAdapterChild imageadapter=new ImageAdapterChild(getBaseContext(), childImages); vpager.setLayoutParams(lparams); vpager.setAdapter(imageadapter); RelLay.addView(vpager); //add child ViewPager into the main ViewPager </code></pre>