适用于拖拽、动画、模糊等效果的UI库

时间:2017-08-11 10:09 来源:互联网 作者:源码搜藏收藏

  • 源码类别:布局类Layouts
  • 源码大小:未知
  • 编码格式:gbk,utf8,不限
  • 运行环境:Android studio
  • 广告推荐

Gradle库依赖allprojects {                repositories {                        ...                        maven { url 'https://jitpack.io' }                }        }
因为模糊库比较大,如果你需要使用模糊效果则依赖的版本{lastest-version}后面加上'-blur',不需要则不用加
compile 'com.github.Rukey7:DragSlopLayout:{lastest-version}-blur'
使用模糊库需要设置对应的配置android {    defaultConfig {        renderscriptTargetApi 23        renderscriptSupportModeEnabled true    }}
Usage属性
name
format
description

mode
enum
drag、animate或者drag_outside, 默认为 drag

fix_height
dimension
drag模式收缩的高度, 默认为 0

max_height
dimension
drag模式展开的高度,默认为布局高度的 2/3

collapse_parallax
float
折叠系数,效果同 CollapsingToolbarLayout,默认为 1
布局<com.dl7.drag.DragSlopLayout        android:id="@+id/drag_layout"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:background="@android:color/black"        app:fix_height="80dp"        app:mode="drag">                                <android.support.v4.view.ViewPager                android:id="@+id/vp_photo"                android:layout_width="match_parent"                android:layout_height="match_parent"/>                                                <LinearLayout                android:layout_width="match_parent"                android:layout_height="wrap_content"                android:orientation="vertical">                // ......        LinearLayout>        // ......com.dl7.drag.DragSlopLayout>
如果 Content View 为 ViewPager,通过以下方法来实现联动效果:    mDragLayout.interactWithViewPager(true);        // 下面新增的方法会更适用,替换上面旧的方法        mDragLayout.attachViewPager(ViewPager);        mDragLayout.detachViewPager();        
如果 Drag View 包含 ScrollView 或则 NestedScrollView,通过以下方法来实现平滑滚动:    mDragLayout.setAttachScrollView(mSvView);
Content View 的模糊效果,这功能是通过模糊预处理再来动态加载的,所以对于 Content View 为 ViewPager 的界面不适用,主要用来模糊固定的背景界面    mDragLayout.setEnableBlur(true);        // 开启模糊    mDragLayout.setBlurFull(true);        // 设置全背景模糊,默认为局部模糊    mDragLayout.updateBlurView();        // 更新模糊背景
控制 Drag View 的进入和退出    mDragLayout.scrollInScreen(int duration);        // Drag 模式    mDragLayout.scrollOutScreen(int duration);        // Drag 模式    mDragLayout.startInAnim();        // Animate 模式    mDragLayout.startOutAnim();        // Animate 模式    mDsLayout.setAnimatorMode(DragSlopLayout.FLIP_Y);        // 设置动画模式
设置拖拽监听    mDragLayout.setDragPositionListener(newDragSlopLayout.OnDragPositionListener() {            @Override            public void onDragPosition(int visibleHeightfloat percentboolean isUp) {                // TODO            }        });
本站资源仅限于学习研究,严禁从事商业或者非法活动! 源码搜藏网所有源码来自互联网转载与用户上传分享,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!

布局类Layouts下载排行

最新文章