File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
lib/src/main/java/com/example/lib Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 1
1
package com.example.lib
2
2
3
+ import android.app.Activity
3
4
import android.content.Context
4
5
import android.support.v4.view.ViewPager
5
6
import android.util.AttributeSet
7
+ import android.util.DisplayMetrics
6
8
7
9
/* *
8
10
* Created by bloder on 25/08/17.
@@ -15,4 +17,13 @@ class Deck : ViewPager {
15
17
init { initView() }
16
18
17
19
private fun initView () = this .setPageTransformer(true , CoverFlowTransformer ())
20
+
21
+ fun useDefaultPadding (context : Activity ) {
22
+ val metrics = DisplayMetrics ()
23
+ context.windowManager.defaultDisplay.getMetrics(metrics)
24
+ val padding = (metrics.widthPixels * 0.08 ).toInt()
25
+ setPadding(padding, 0 , padding, 0 )
26
+ clipToPadding = false
27
+ pageMargin = 0
28
+ }
18
29
}
You can’t perform that action at this time.
0 commit comments