@@ -7,13 +7,16 @@ Screenshot
77---
88
99#### Drag模式,可以和 ViewPager 联动
10- ![ Drag] ( https://github. com/Rukey7/AndroidCommon/blob/ master/ScreenShot /DragSlopLayout/drag.gif )
10+ ![ Drag] ( https://raw.githubusercontent. com/Rukey7/ScreenShot/ master/DragSlopLayout/drag.gif )
1111
1212#### Animate模式,同样可以和 ViewPager 联动(自定义动画无联动效果)
13- ![ Animate] ( https://github. com/Rukey7/AndroidCommon/blob/ master/ScreenShot /DragSlopLayout/animate.gif )
13+ ![ Animate] ( https://raw.githubusercontent. com/Rukey7/ScreenShot/ master/DragSlopLayout/animate.gif )
1414
1515#### Blur模糊效果,包括局部模糊和全图模糊
16- ![ Blur] ( https://raw.githubusercontent.com/Rukey7/AndroidCommon/master/ScreenShot/DragSlopLayout/blur.gif )
16+ ![ Blur] ( https://raw.githubusercontent.com/Rukey7/ScreenShot/master/DragSlopLayout/blur.gif )
17+
18+ #### 外部拖拽,在屏幕上垂直滑动就可对视图进行拖拽,能够设置主视图滑动折叠
19+ ![ Blur] ( https://raw.githubusercontent.com/Rukey7/ScreenShot/master/DragSlopLayout/drag_out.gif )
1720
1821Gradle
1922---
@@ -32,7 +35,7 @@ allprojects {
3235因为模糊库比较大,如果你需要使用模糊效果则依赖的版本{lastest-version}后面加上'-blur',不需要则不用加
3336
3437``` gradle
35- compile 'com.github.Rukey7:IjkPlayerView :{lastest-version}-blur'
38+ compile 'com.github.Rukey7:DragSlopLayout :{lastest-version}-blur'
3639```
3740
3841### 使用模糊库需要设置对应的配置
5962
6063### 布局
6164``` xml
65+
6266<com .dl7.drag.DragSlopLayout
6367 android:id=" @+id/drag_layout"
6468 android:layout_width=" match_parent"
@@ -85,27 +89,41 @@ Usage
8589
8690### 如果 Content View 为 ViewPager,通过以下方法来实现联动效果:
8791``` java
92+
8893 mDragLayout. interactWithViewPager(true );
8994```
9095### 如果 Drag View 包含 ScrollView 或则 NestedScrollView,通过以下方法来实现平滑滚动:
9196``` java
97+
9298 mDragLayout. setAttachScrollView(mSvView);
9399```
94100### Content View 的模糊效果,这功能是通过模糊预处理再来动态加载的,所以对于 Content View 为 ViewPager 的界面不适用,主要用来模糊固定的背景界面
95101``` java
102+
96103 mDragLayout. setEnableBlur(true ); // 开启模糊
97104 mDragLayout. setBlurFull(true ); // 设置全背景模糊,默认为局部模糊
98105 mDragLayout. updateBlurView(); // 更新模糊背景
99106```
100107### 控制 Drag View 的进入和退出
101108``` java
109+
102110 mDragLayout. scrollInScreen(int duration); // Drag 模式
103111 mDragLayout. scrollOutScreen(int duration); // Drag 模式
104112
105113 mDragLayout. startInAnim(); // Animate 模式
106114 mDragLayout. startOutAnim(); // Animate 模式
107115 mDsLayout. setAnimatorMode(DragSlopLayout . FLIP_Y ); // 设置动画模式
108116```
117+ ### 设置拖拽监听
118+ ``` java
119+
120+ mDragLayout. setDragPositionListener(new DragSlopLayout .OnDragPositionListener () {
121+ @Override
122+ public void onDragPosition (int visibleHeight , float percent , boolean isUp ) {
123+ // TODO
124+ }
125+ });
126+ ```
109127
110128Thanks
111129---
0 commit comments