I’m building a gallery following this tutorial.Until now i’ve managed to display the images with swipe function like below
public Object instantiateItem(View collection, int position) {
LayoutInflater inflater = (LayoutInflater) collection.getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
int Id = 0;
switch (position) {
case 0:
Id = R.layout.farleft;
break;
case 1:
Id = R.layout.left;
break;
}
View view = inflater.inflate(resId, null);
((ViewPager) collection).addView(view, 0);
return view;
}
But i want to display a lot of pictures so i can’t crete hundrets of cases for setting hundrets of different layouts.So what options do i have here?Can someone point me to the right direction?
Try like this way..
Try link too
https://github.com/ysamlan/horizontalpager