Android图片添加标签:Android-PictureTagView

本文提供了一种在Android应用中给图片添加标签的方法,通过使用开源库Android-PictureTagView实现这一功能。介绍了如何在布局中使用该库,包括将ImageView与PictureTagLayout结合使用,以及其基本的使用步骤。此外,还提供了相关文章链接,帮助开发者进一步了解和深入开发。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >



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将被用户的点击事件触发添加标签动作。


比如,写一个布局文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:orientation="vertical" >

    <com.picturetagview.PictureTagLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/ic_launcher" />

</LinearLayout>


运行结果如图:


附录一些相关供进一步开发的文章:
《Android View转换成图片保存》链接地址:http://blog.youkuaiyun.com/zhangphil/article/details/44217539

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zhangphil

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值