android 动画 拖拽,AnimateCircleImageViewLibrary

可以拖拽的 CircleImageView

从屏幕松手图片位置自动复原,带回弹效果

ScreenRecord_2018-04-12-15-53-23.gif

How to use

Step 1. Add the JitPack repository to your build file

allprojects {

repositories {

...

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

}

}

Step 2. Add the dependency

dependencies {

implementation 'com.github.CeuiLiSA:AnimateCircleImageViewLibrary:1.1.0'

}

Step 3. use it in xml

xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:app="http://schemas.android.com/apk/res-auto"

xmlns:tools="http://schemas.android.com/tools"

android:id="@+id/my_image_view"

android:layout_width="match_parent"

android:layout_height="match_parent"

app:circleImgBorder="3"

app:circleImgBorderColor="@color/colorAccent"

app:circleImgRadius="110"

app:circleViewsCount="5"

app:topMargin="200">

Step 4. in xxx.class

加载本地图片:

public class MainActivity extends AppCompatActivity {

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.head);

DragImageView dragImageView = findViewById(R.id.my_image_view);

dragImageView.setImageResource(bitmap);

}

}

加载网络图片:

public class MainActivity extends AppCompatActivity {

private DragImageView mDragImageView;

private static final String url =

"https://i.pximg.net/c/480x960/img-master/img/2018/03/18/00/00/03/67786060_p0_master1200.jpg";

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

mDragImageView = findViewById(R.id.my_image_view);

Glide.with(this).load(url).asBitmap().into(new SimpleTarget() {

@Override

public void onResourceReady(Bitmap resource, GlideAnimation super Bitmap> glideAnimation) {

mDragImageView.setImageResource(resource);

}

});

}

}

使用到的开源库:

implementation 'de.hdodenhof:circleimageview:2.2.0'

implementation 'com.facebook.rebound:rebound:0.3.8'

implementation 'com.github.bumptech.glide:glide:3.8.0'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值