# EasyTagDragView
仿网易新闻app下拉标签选择菜单,长按拖动排序,点击增删标签控件
##示例
![introduce.gif](introduce.gif)
##EasyTagDragView的使用
在layout布局里添加:
<com.wenhuaijun.easytagdragview.EasyTipDragView
android:id="@+id/easy_tip_drag_view"
android:background="@android:color/white"
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_height="match_parent"/>
在java代码中:
给EasyTagDragView添加标签数据,包括已添加的标签数据和可添加的标签数据。
添加的数据bean需继承SimpleTitleTip类,可自由增加成员属性。如没特殊需求,可直接使用提供的SimpleTitleTip类。
注意每个tip的id必须唯一,不然拖拽会有bug
//设置已添加的的标签数据
easyTipDragView.setDragData(TipDataModel.getDragTips());
//设置可以添加的标签数据
easyTipDragView.setAddData(TipDataModel.getAddTips());
//显示EasyTagDragView
easyTipDragView.open();
//在easyTipDragView处于非编辑模式下点击item的回调(编辑模式下点击item作用为删除item)
easyTipDragView.setSelectedListener(new TipItemView.OnSelectedListener() {
@Override
public void onTileSelected(Tip entity, int position, View view) {
toast(((SimpleTitleTip) entity).getTip());
}
});
//设置每次数据改变后的回调(例如每次拖拽排序了标签或者增删了标签都会回调)
easyTipDragView.setDataResultCallback(new EasyTipDragView.OnDataChangeResultCallback() {
@Override
public void onDataChangeResult(ArrayList<Tip> tips) {
Log.i("heheda", tips.toString());
}
});
//设置点击“确定”按钮后最终数据的回调
easyTipDragView.setOnCompleteCallback(new EasyTipDragView.OnCompleteCallback() {
@Override
public void onComplete(ArrayList<Tip> tips) {
toast("最终数据:" + tips.toString());
}
});
注:当已经显示EasyTagDragView的时候,需监听返回键,
在编辑模式下点击返回键取消编辑模式。非编辑模式下则关闭EasyTagDragView
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode){
//点击返回键
case KeyEvent.KEYCODE_BACK:
//判断easyTipDragView是否已经显示出来
if(easyTipDragView.isOpen()){
if(!easyTipDragView.onKeyBackDown()){
btn.setVisibility(View.VISIBLE);//自己的业务逻辑
}
return true;
}
//....自己的业务逻辑
break;
}
return super.onKeyDown(keyCode, event);
}
**后期增加更多自定义属性和一些API,将View放入popupWindow,增加过渡动画**
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
EasyTagDragView-master.zip (58个子文件)
EasyTagDragView-master
gradlew.bat 2KB
gradlew 5KB
gradle.properties 855B
introduce.gif 535KB
app
proguard-rules.pro 678B
src
test
java
com
wenhuaijun
easytagdragview
ExampleUnitTest.java 323B
androidTest
java
com
wenhuaijun
easytagdragview
ApplicationTest.java 361B
main
res
mipmap-xxxhdpi
ic_launcher.png 10KB
drawable
tag_item_bg.xml 794B
delete.png 230B
ic_delete.png 691B
tag_add_bg.xml 807B
mipmap-hdpi
ic_launcher.png 3KB
values
colors.xml 1KB
animation_constants.xml 748B
strings.xml 78B
attrs.xml 241B
styles.xml 823B
dimens.xml 211B
mipmap-xxhdpi
ic_launcher.png 8KB
mipmap-mdpi
ic_launcher.png 2KB
mipmap-xhdpi
ic_launcher.png 5KB
layout
view_add_item.xml 621B
view_tag_item.xml 954B
view_easytagdrag.xml 4KB
activity_main.xml 652B
values-w820dp
dimens.xml 358B
java
com
wenhuaijun
easytagdragview
bean
SimpleTitleTip.java 480B
Tip.java 117B
adapter
DragTipAdapter.java 3KB
AbsTipAdapter.java 14KB
AddTipAdapter.java 1KB
widget
DragDropGirdView.java 11KB
DragDropController.java 3KB
TipItemView.java 5KB
EasyTipDragView.java 6KB
listener
OnDragDropListener.java 1KB
demo
TipDataModel.java 1KB
MainActivity.java 3KB
AndroidManifest.xml 693B
app.iml 9KB
.gitignore 7B
build.gradle 681B
gradle
wrapper
gradle-wrapper.jar 49KB
gradle-wrapper.properties 239B
.idea
gradle.xml 722B
runConfigurations.xml 564B
misc.xml 3KB
vcs.xml 180B
copyright
profiles_settings.xml 74B
modules.xml 367B
encodings.xml 159B
compiler.xml 686B
.gitignore 91B
EasyTagDragView.iml 946B
README.md 3KB
settings.gradle 15B
build.gradle 498B
共 58 条
- 1
资源评论
小宇宙_sky
- 粉丝: 0
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功