Android仿小红书图片标签

项目地址GitHub

TagViewGroup

Android 仿小红书图片标签,实现了图片标签的动画,布局,水波纹,编辑等功能,还可以自定义 Tag。视频演示地址

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:v1.1'
}

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());
tagViewGroup.setShowAnimator(AnimatorUtils.getTagShowAnimator(tagViewGroup))
        .setHideAnimator(AnimatorUtils.getTagHideAnimator(tagViewGroup))
        .addTagList(tagViewList)
        .setPercent(percentX,percentY)
        .addRipple();

Attributes:

attr属性 description 描述
inner_radius 中心内圆半径
radius 中心外圆半径
line_width 线条宽度
v_distance 圆心到垂直折点的垂直距离
tilt_distance 圆心到斜线折点的垂直距离
ripple_alpha 水波纹起始透明度
ripple_maxRadius 水波纹最大半径

How to implement your own Tag view

Step 1. create a view implement ITagView interface.

Step 2. Override the following methods:

@Override
public void setDirection(DIRECTION direction) {
    mDirection = direction;
}

@Override
public DIRECTION getDirection() {
    return mDirection;
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 项目地址GitHub TagViewGroup Android 仿小红书图片标签,实现了图片标签的动画,布局,水波...
    licrafter阅读 7,142评论 0 5
  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,648评论 2 45
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 13,394评论 0 23
  • 12月份了,天气不冷 这是个暖冬 没有雪,也没有妩媚的窗花 在北方,也从来没有见过所谓的迎春花 在太阳底下开放 偶...
    陈士武阅读 2,790评论 0 0
  • 近来神经不受控制,嘈杂个不停。下班,四处都是黑暗,远方的宿舍星光点点,班车的呐喊像是沒有尽头,天空也是黑暗,挂着一...
    光趟芍儿阅读 1,716评论 0 1