Skip to content

Commit bbe7cea

Browse files
committed
2 parents 4e74d00 + 3912d65 commit bbe7cea

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# AnimateCircleImageViewLibrary
2+
3+
可以拖拽的CircleImageView
4+
5+
从屏幕松手图片位置自动复原,带回弹效果
6+
7+
![截图](https://github.com/CeuiLiSA/images/blob/master/ScreenRecord_2018-04-12-15-53-23.gif)
8+
9+
# How to use
10+
11+
Step 1. Add the JitPack repository to your build file
12+
~~~
13+
allprojects {
14+
repositories {
15+
...
16+
maven { url 'https://jitpack.io' }
17+
}
18+
}
19+
~~~
20+
21+
Step 2. Add the dependency
22+
~~~
23+
dependencies {
24+
implementation 'com.github.CeuiLiSA:AnimateCircleImageViewLibrary:1.0.1'
25+
}
26+
~~~
27+
28+
Step 3. use it in xml
29+
~~~
30+
<?xml version="1.0" encoding="utf-8"?>
31+
<com.example.administrator.mycircleimgview.views.DragImageView
32+
xmlns:android="http://schemas.android.com/apk/res/android"
33+
xmlns:app="http://schemas.android.com/apk/res-auto"
34+
android:id="@+id/my_image_view"
35+
android:layout_width="match_parent"
36+
android:layout_height="match_parent"
37+
app:circleImgBorderColor="@color/colorAccent"
38+
app:circleImgRadius="110"
39+
app:circleImgBorder="3"
40+
app:topMargin="200"
41+
app:circleViewsCount="5">
42+
43+
44+
</com.example.administrator.mycircleimgview.views.DragImageView>
45+
~~~
46+
47+
Step 4. in xxx.class
48+
49+
加载本地图片:
50+
~~~
51+
public class MainActivity extends AppCompatActivity {
52+
@Override
53+
protected void onCreate(Bundle savedInstanceState) {
54+
super.onCreate(savedInstanceState);
55+
setContentView(R.layout.activity_main);
56+
57+
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.head);
58+
DragImageView dragImageView = findViewById(R.id.my_image_view);
59+
dragImageView.setImageResource(bitmap);
60+
}
61+
}
62+
~~~
63+
64+
加载网络图片:
65+
66+
~~~
67+
public class MainActivity extends AppCompatActivity {
68+
69+
private DragImageView mDragImageView;
70+
private static final String url =
71+
"https://i.pximg.net/c/480x960/img-master/img/2018/03/18/00/00/03/67786060_p0_master1200.jpg";
72+
73+
@Override
74+
protected void onCreate(Bundle savedInstanceState) {
75+
super.onCreate(savedInstanceState);
76+
setContentView(R.layout.activity_main);
77+
78+
mDragImageView = findViewById(R.id.my_image_view);
79+
Glide.with(this).load(url).asBitmap().into(new SimpleTarget<Bitmap>() {
80+
@Override
81+
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
82+
mDragImageView.setImageResource(resource);
83+
}
84+
});
85+
}
86+
}
87+
~~~
88+
89+
使用到的开源库:
90+
~~~
91+
implementation 'de.hdodenhof:circleimageview:2.2.0'
92+
implementation 'com.facebook.rebound:rebound:0.3.8'
93+
implementation 'com.github.bumptech.glide:glide:3.8.0'
94+
~~~

0 commit comments

Comments
 (0)