我正在创建一个使用ViewPager显示一些照片的活动。我想在主ViewPager的任何页面中添加另一个小ViewPager。当我刷一点ViewPager主ViewPager滑动时。我希望主ViewPager不要滑动。
我该怎么做?
注意:我通过编程方式添加所有元素。
RelativeLayout RelLay=(RelativeLayout) viewPager.findViewById(arg0); //main ViewPager page
final ViewPager vpager=new ViewPager(getBaseContext());
ArrayList<String> childImages=new ArrayList<String>();
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