仿小红书的图片标签
来源:互联网 发布:南京水科院怎么样知乎 编辑:程序博客网 时间:2024/09/21 09:21
TagViewGroup
项目地址:shellljx/TagViewGroup
简介:仿小红书的图片标签
更多:作者 提 Bug 示例 APK
标签:
图片标签-小红书-自定义ViewGroup-Android 仿小红书
图片标签,实现了图片标签的动画,布局,水波纹,编辑等功能,还可以自定义 Tag。视频演示地址
This is a library of tags that are attached to the picture,you can add tags and ripple effects very easily.Video demo
Important Update
added
TagAdapter
and make it easier to create TagViewGroup.moved
AnimatorUtils
out of the library to make it clean.
Gradle
Step 1. Add it in your root build.gradle at the end of repositories:
allprojects { repositories { ... maven { url 'https://jitpack.io' } }}
Step 2. Add the dependency
dependencies { compile 'com.github.shellljx:TagViewGroup:-SNAPSHOT'}
How to use
1. Define in xml
<com.licrafter.tagview.TagViewGroup android:id="@+id/tagViewGroup" android:layout_width="wrap_content" android:layout_height="wrap_content" app:inner_radius="4dp" app:line_width="1dp" app:radius="8dp" app:ripple_alpha="100" app:ripple_radius="20dp" app:tilt_distance="20dp"/>
2. Or in code
TagViewGroup tagViewGroup = new TagViewGroup(getContext());
3. Add animator
// set hide animator ,show animator and rippletagViewGroup.setHideAnimator(hideAnimator).setShowAnimator(showAnimator).addRipple();
4. Set tagAdapter
tagViewGroup.setTagAdapter(new TagAdapter() { @Override public int getCount() { return model.getTags().size(); } @Override public ITagView getItem(int position) { return makeTagTextView(model.getTags().get(position)); }});//set tagViewGroup locationtagViewGroup.setPercent(model.getPercentX(), model.getPercentY());
5. NotifyDataSetChanged
tagViewGroup.getTagAdapter().notifyDataSetChanged();
6. Handle click events
tagViewGroup.setOnTagGroupClickListener(new TagViewGroup.OnTagGroupClickListener() { @Override public void onCircleClick(TagViewGroup container) { //click the white circle of TagViewGroup } @Override public void onTagClick(TagViewGroup container, ITagView tag, int position) { //clikc a tag of TagViewGroup } @Override public void onLongPress(TagViewGroup container) { }});
7. Drag TagViewGroup
//you can drag tagViewGroup only if you set OnTagGroupDragListenertagViewGroup.setOnTagGroupDragListener(new TagViewGroup.OnTagGroupDragListener() { @Override public void onDrag(TagViewGroup container, float percentX, float percentY) { }});
Attributes:
How to customize the animation
You can use the following properties in Property Animation:
How to implement your own Tag view
Step 1. create a view implement ITagView
interface.
Step 2. Override the following methods:
@Overridepublic void setDirection(DIRECTION direction) { mDirection = direction;}@Overridepublic DIRECTION getDirection() { return mDirection;}
阅读全文
0 0
- 仿小红书的图片标签
- 设置标签的默认图片
- 设置标签的默认图片
- 关于HTML的图片标签
- 图片标签
- 图片标签
- 设置浏览器标签的右侧的图片
- xslt三种带图片的超链接(a标签,img标签)写法
- 初学,html中的标签以及图片的标签内容
- Struts2图片按钮标签的使用方法
- HTML 标签(图片映射、热点)的使用
- 标签TabHost图片文字覆盖的问题
- html标签ul li 的列表图片
- 图片(img标签)的onerror事件
- 图片(img标签)的onerror事件
- 图片(img标签)的onerror事件
- 指定img标签默认图片的方法
- HTML 标签(图片映射、热点)的使用
- js获取时间进行比较
- python打包.py文件为exe文件,无需安装python环境
- c++ prime plus 第三章
- 开放api接口签名验证
- Ubuntu 16.04 桌面版安装后的一些注意事项
- 仿小红书的图片标签
- 使用jmap和MAT分析JVM堆内存
- 微信支付
- JavaSE 集合框架(9)- ConcurrentHashMap
- 隐藏基于对话框的MFC应用程序窗口的方法 (推荐这个方法,非常好用)
- 浅谈web自适应
- 项目总结
- MySql sql语句
- 用IDEA基于maven项目使用mybatis-generator-plugin生成mapper和pojo