TagViewGroup
Android 仿小紅書
圖片標(biāo)簽,實(shí)現(xiàn)了圖片標(biāo)簽的動畫振湾,布局球涛,水波紋劣针,編輯等功能,還可以自定義 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 | 中心內(nèi)圓半徑 |
radius | 中心外圓半徑 |
line_width | 線條寬度 |
v_distance | 圓心到垂直折點(diǎn)的垂直距離 |
tilt_distance | 圓心到斜線折點(diǎn)的垂直距離 |
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;
}