当前位置: 代码迷 >> Android >> AndroidTagGroup实现云标签成效-IT蓝豹
  详细解决方案

AndroidTagGroup实现云标签成效-IT蓝豹

热度:50   发布时间:2016-04-27 22:42:07.0
AndroidTagGroup实现云标签效果-IT蓝豹

AndroidTagGroup实现云标签效果,各种背景效果的标签,并且支持添加,
大体实现:有一个TagsManager管理TagGroup,自定义TagGroup,对TagGroup设置setTags(tags);
TagGroup extends ViewGroup,TagGroup 由多个TagView组成,TagView继承TextView 。
主要绘制代码如下:
?? @Override
??????? protected void onDraw(Canvas canvas) {
??????????? canvas.drawArc(mLeftCornerRectF, -180, 90, true, mBackgroundPaint);
??????????? canvas.drawArc(mLeftCornerRectF, -270, 90, true, mBackgroundPaint);
??????????? canvas.drawArc(mRightCornerRectF, -90, 90, true, mBackgroundPaint);
??????????? canvas.drawArc(mRightCornerRectF, 0, 90, true, mBackgroundPaint);
??????????? canvas.drawRect(mHorizontalBlankFillRectF, mBackgroundPaint);
??????????? canvas.drawRect(mVerticalBlankFillRectF, mBackgroundPaint);

??????????? if (isChecked) {
??????????????? canvas.save();
??????????????? canvas.rotate(45, mCheckedMarkerBound.centerX(), mCheckedMarkerBound.centerY());
??????????????? canvas.drawLine(mCheckedMarkerBound.left, mCheckedMarkerBound.centerY(),
??????????????????????? mCheckedMarkerBound.right, mCheckedMarkerBound.centerY(), mCheckedMarkerPaint);
??????????????? canvas.drawLine(mCheckedMarkerBound.centerX(), mCheckedMarkerBound.top,
??????????????????????? mCheckedMarkerBound.centerX(), mCheckedMarkerBound.bottom, mCheckedMarkerPaint);
??????????????? canvas.restore();
??????????? }
??????????? canvas.drawPath(mBorderPath, mBorderPaint);
??????????? super.onDraw(canvas);
??????? }

?

运行效果:

?

?

相关代码

  • AndroidTagGroup实现云标签效果
  • BlurZoomGallery一个完美下拉进入大图模式
  • 高质量的客户端引导动画效果
  • Material Design风格SearchView实现语音搜索功能
  • WilliamChart各种图表效果实现大全
  • ViewPager实现欢迎页面动画效果
  • 闹钟AlarmAndMusic 滑动调整时间和页面旋转风车效果
  • FlipViewPager 对item实现左右对折滑动翻页效果
  • 高仿网易云音乐客户端的Home页面切换Tabhost
  • 几种常用Android Progress效果
  相关解决方案