Android TagView 云标签

谢晓枫 YY娱乐

http://code.yy.com/xiexiaofeng/android-cloud-tagview

https://github.com/kaedea

网页上常见的云标签

https://github.com/kaedea

Feature


https://github.com/kaedea

Sample Screenshots

https://github.com/kaedea

Design

方案一

方案二

https://github.com/kaedea

方案一在实际项目中的使用

Bilibili v3.0 视频详情页

方案二在实际项目中的使用

YY 3.7 搜索页

Android SpannableString

Android View

通过XML布局文件使用

   <me.kaede.tagview.TagView
            android:id="@+id/tagview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            app:lineMargin="5dp" //行距
            app:tagMargin="3dp"  //间距
            app:textPaddingBottom="3dp"
            app:textPaddingLeft="10dp"
            app:textPaddingRight="10dp"
            app:textPaddingTop="3dp">
   </me.kaede.tagview.TagView>       

https://github.com/kaedea

通过JAVA代码使用

   TagView tagview2 = new TagView(this);
   tagview2.setLineMargin(20f);//dp
   tagview2.setTagMargin(20f);
   tagview2.setTextPaddingLeft(20f);
   tagview2.setTextPaddingTop(20f);
   tagview2.setTextPaddingRight(20f);
   tagview2.setTexPaddingBottom(20f);    
https://github.com/kaedea

添加标签

String[] tags = getResources().getStringArray(R.array.continents);
tagView.addTags(tags); 
Tag tag = new Tag("Tag Text");
tag.tagTextColor = Color.parseColor("#FFFFFF");
tag.layoutColor =  Color.parseColor("#DDDDDD");
tag.layoutColorPress = Color.parseColor("#555555");
//tag.background = this.getResources().getDrawable(R.drawable.custom_bg);
tag.radius = 20f;
tag.tagTextSize = 14f;
tag.layoutBorderSize = 1f;
tag.layoutBorderColor = Color.parseColor("#FFFFFF");
tag.isDeletable = true;
tagView.addTag(tag);
https://github.com/kaedea

Exceptions

https://github.com/kaedea

THANK YOU

YY娱乐 谢晓枫