android图片标签搜索,Android图片添加标签:Android-PictureTagView



Android图片添加标签:Android-PictureTagView

在一些社交类、美图类的Android APP中,会给用户提供一项功能就是给图片添加一些标签,这种功能需求可以使用一个在githubs上的第三方的开源库Android-PictureTagView。

Android-PictureTagView在github上的项目主页:https://github.com/saiwu-bigkoo/Android-PictureTagView

截止目前,Android-PictureTagView的版本中,比较关键的是PictureTagLayout。此类将加载到PictureTagLayout布局中的ImageView添加一些标签,当点击PictureTagLayout布局中的ImageView时,就自动添加进去一些标签,这些标签支持拖曳移动,但似乎目前不支持添加后删除,如果欲删除这些标签,则需要开发者自己再做二次定制开发,据我初步对源代码的阅读和分析,比如,可以在PictureTagLayout中增加长按事件,长按后弹出对话框然后删除等等动作。

(1) 使用Android-PictureTagView。直接在布局中像普通的线性布局或者相对布局一样使用PictureTagLayout(PictureTagLayout继承自RelativeLayout)。

(2) 在PictureTagLayout中写入一个ImageView。此ImageView将被用户的点击事件触发添加标签动作。

比如,写一个布局文件:

android:layout_width="match_parent"

android:layout_height="match_parent"

android:background="@android:color/white"

android:orientation="vertical" >

android:layout_width="match_parent"

android:layout_height="match_parent"

android:background="@drawable/ic_launcher" />

运行结果如图:

08d0de599319c869312d9dcaca482869.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值