FlycooLabelView显示角标效果
来源:互联网 发布:成都数据恢复公司 编辑:程序博客网 时间:2024/06/05 04:59
github上的一段开源代码,功能很简单,就是实现角标效果,如下:
原理:
实现了一个LabelView类,继承View类,重写onDraw()、onMeasure()等方法,自定义界面
使用方法:
1、添加依赖
compile 'com.flyco.labelview:FlycoLabelView_Lib:1.0.2@aar'
2、配置xml例子
<FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content"><ImageView android:layout_width="match_parent" android:layout_height="200dp" android:scaleType="centerCrop" android:src="@mipmap/haha"/> <com.flyco.labelview.LabelView xmlns:lv="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="10dp" android:paddingRight="10dp" lv:lv_text="Hot" lv:lv_text_size="12sp"/> <com.flyco.labelview.LabelView xmlns:lv="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" lv:lv_background_color="#3F9FE0" lv:lv_gravity="TOP_RIGHT" lv:lv_text="二哈" lv:lv_text_size="12sp"/> <com.flyco.labelview.LabelView xmlns:lv="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|left" lv:lv_background_color="#F6CE59" lv:lv_gravity="BOTTOM_LEFT" lv:lv_text="会员" lv:lv_text_all_caps="false" lv:lv_text_size="12sp"/> <com.flyco.labelview.LabelView xmlns:lv="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|right" lv:lv_background_color="#EC7263" lv:lv_gravity="BOTTOM_RIGHT" lv:lv_text="new"/></FrameLayout><FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="40dp"> <ImageView android:layout_width="match_parent" android:layout_height="200dp" android:scaleType="centerCrop" android:src="@mipmap/haha"/> <com.flyco.labelview.LabelView xmlns:lv="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" lv:lv_fill_triangle="true" lv:lv_text="新" lv:lv_text_size="12sp"/> <com.flyco.labelview.LabelView xmlns:lv="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:paddingLeft="5dp" android:paddingRight="5dp" lv:lv_background_color="#3F9FE0" lv:lv_fill_triangle="true" lv:lv_gravity="TOP_RIGHT" lv:lv_text="大哈" lv:lv_text_size="12sp"/> <com.flyco.labelview.LabelView xmlns:lv="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|left" lv:lv_background_color="#F6CE59" lv:lv_fill_triangle="true" lv:lv_gravity="BOTTOM_LEFT" lv:lv_text="会员" lv:lv_text_all_caps="false" lv:lv_text_size="12sp"/> <com.flyco.labelview.LabelView xmlns:lv="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|right" lv:lv_background_color="#EC7263" lv:lv_fill_triangle="true" lv:lv_gravity="BOTTOM_RIGHT" lv:lv_text="new"/></FrameLayout>3、具体属性介绍
name format description
https://github.com/H07000223/FlycoLabelView
0 0
- FlycooLabelView显示角标效果
- 显示图片渐隐效果
- 分页显示效果!
- 显示图片渐隐效果
- 显示效果测试
- 文本的显示效果
- 窗口显示的效果
- 网页中显示效果
- 看看代码显示效果
- EXTJS DateField 效果显示
- 图片定时显示效果
- div显示隐藏效果
- div显示隐藏效果
- LCD显示负片效果
- 文字同步显示效果
- JSP 显示分页效果
- 优化按钮显示效果
- flex flash 显示效果
- JVM内核—JVM调优
- win7创建软链接
- 用SymPy简化神经网络的求导(微分)
- C++ 栈 与 堆 【GeekBand 第二周】
- 软件测试的流程
- FlycooLabelView显示角标效果
- ArrayList
- Fragment生命周期
- matplotlib 资料收集
- 菜鸟学习JVM(一)——垃圾回收算法
- jQuery实现二级菜单显示(超链接中)
- 优化UITableViewCell高度计算的那些事
- 使用maven创建基于spring框架的scala web工程
- [Git日记](1)Git安装