otak info official Logo   
OTAK.INFO
Personal Blog

Hariyanto Lim

정길상 / 鄭吉祥
Home   Last Posts  
 
Please login to see more topics and discussion categories.
 
goto main category list >> Software programming >> Android

Title : How to show Adjacent Pages in ViewPager
Total Reply : 0
Total View : 1874


Harry
Harry
Total thread: 131
Total reply: 50

Post #151
How to show Adjacent Pages in ViewPager
1. Set the padding of the ViewPager
a. Can be defined in XML
'
'.str_replace('
', ' ', '
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="20dp"
android:paddingRight="20dp"
/>
').'
'
b. Or set in source code
'
'.str_replace('
', ' ', '
int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics());
mViewPager.setPadding(margin, 0, margin, 0);
').'
'

2. make sure the ViewPager to draw all width without clipping to padding
'
'.str_replace('
', ' ', '
mViewPager.setClipToPadding(false);
').'
'

How to show Adjacent Pages in ViewPager
Falling in love with the world

Write : 2015-03-23 13:09:47

If you want to create a new reply then please login first.



www.OTAK.INFO
Since 19 January 2007
Page hit : 858,647

Code update 24th June 2013
Brain is a very capable to solve big problems
but requires constant reminders about how to.
peace bird