DragLayout的使用方法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_40998254/article/details/86513643

DragLayout中的子view可以实现任意拖动,不影响本身的点击事件,其继承自RelativeLayout,所以所有的RelativeLayout的属性DragLayout都适用。

用DragLayout可以轻易实现下面的效果:

开源项目的github地址DragLayout

一、接入方法: 1,在app的build.gradle添加

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

2,在app的build.gradle添加

dependencies {
        implementation 'com.github.xiaoxiao9575:DragLayout:1.0.0'
}

二、使用方法:

<com.github.gjp.draglayout.DragLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:src="@mipmap/ic_launcher_round"
        />

</com.github.gjp.draglayout.DragLayout>

注:如果使用中存在问题和建议请在本文章评论处留言。

猜你喜欢

转载自blog.csdn.net/weixin_40998254/article/details/86513643