Reputation: 1685
I am making one app on ViewPager. and I am trying to do increase and decrease width of ViewPager's child.Is it possible or not?if possible than help me advance in thanks.
Upvotes: 1
Views: 1070
Reputation: 9867
Try setting the padding option of the View pager, it will decrease the size of inner content
Upvotes: 0
Reputation: 30855
You can set the width of child using LayoutParam, suppose you have TextView in your viewpager then in instantiateItem()
@Override
public Object instantiateItem(final ViewGroup vGroup, int position) {
TextView tv = new TextView(context);
// set as fill parent
tv.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
// set as wrap_content
tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
// or by set as fixed size
tv.setLayoutParams(new LayoutParams(150, 200));
vGroup.add(tv);
}
Upvotes: 1