一个功能强大的 TextView,可以满足日常大部分布局方式,开发者可已自行组合属性配置出属于自己风格的样式!
来源:互联网 发布:数据接口类型有哪些 编辑:程序博客网 时间:2024/05/21 21:39
SuperTextView
项目地址:lygttpod/SuperTextView
简介:一个功能强大的 TextView,可以满足日常大部分布局方式,开发者可已自行组合属性配置出属于自己风格的样式!
一个功能强大的 TextView,可以满足日常大部分布局方式,开发者可已自行组合属性配置出属于自己风格的样式!
效果图
基本使用
1.添加 Gradle 依赖
dependencies { ... compile 'com.allen.supertextview:supertextview:1.0.1' }
2.布局中如何使用
<com.allen.supertextviewlibrary.SuperTextView android:id="@+id/super_tv" android:layout_width="match_parent" android:layout_height="80dp" stv:sLeftBottomTextColor2="@color/colorAccent" stv:sLeftBottomTextString="招商银行(8888)" stv:sLeftBottomTextString2="限额说明>>" stv:sLeftIconRes="@drawable/bank_zhao_shang" stv:sLeftTopTextString="银行卡支付" stv:sRightCheckBoxRes="@drawable/circular_check_bg" stv:sRightCheckBoxShow="true" stv:sLineShow="bottom" /> 注意: 1、上下的线可以通过 sLineShow 设置 有四种显示方式 none,top,bottom,both 2、通过设置 sUseRipple=true 开启水波效果
3.代码中如何使用
/** * 可以通过链式设置大部分常用的属性值 */ superTextView.setLeftIcon(drawable) .setLeftString("") .setLeftTVColor(0) .setLeftTopString("") .setLeftTopTVColor(0) .setLeftBottomString("") .setLeftBottomTVColor(0) .setLeftBottomString2("") .setLeftBottomTVColor2(0) .setRightString("") .setRightTVColor(0) .setCbChecked(true) .setCbBackground(drawable) .setRightIcon(drawable) .setRightString("") .setRightTVColor(0) .setLeftString("") .setOnSuperTextViewClickListener(new SuperTextView.OnSuperTextViewClickListener() { @Override public void onSuperTextViewClick() { super.onSuperTextViewClick(); //do something } @Override public void onLeftTopClick() { super.onLeftTopClick(); //do something } @Override public void onLeftBottomClick() { super.onLeftBottomClick(); //do something } @Override public void onLeftBottomClick2() { super.onLeftBottomClick2(); //do something } });
4.点击事件(可根据需求选择实现某个点击事件)
superTextView.setOnSuperTextViewClickListener(new SuperTextView.OnSuperTextViewClickListener() { @Override public void onSuperTextViewClick() { super.onSuperTextViewClick(); //do something } @Override public void onLeftTopClick() { super.onLeftTopClick(); //do something } @Override public void onLeftBottomClick() { super.onLeftBottomClick(); //do something } @Override public void onLeftBottomClick2() { super.onLeftBottomClick2(); //do something } });
5.属性说明(以下属性全部可以通过 xml 文件配置和代码进行设置)
<declare-styleable name="SuperTextView"> <attr name="sLeftIconRes" format="reference"/> <attr name="sRightIconRes" format="reference"/> <attr name="sRightCheckBoxRes" format="reference"/> <attr name="sLeftTextString" format="string"/> <attr name="sCenterTextString" format="string"/> <attr name="sRightTextString" format="string"/> <attr name="sLeftTopTextString" format="string"/> <attr name="sLeftBottomTextString" format="string"/> <attr name="sLeftBottomTextString2" format="string"/> <attr name="sTopLineMargin" format="dimension"/> <attr name="sBottomLineMargin" format="dimension"/> <attr name="sBothLineMargin" format="dimension"/> <attr name="sLeftIconMarginLeft" format="dimension"/> <attr name="sLeftTextMarginLeft" format="dimension"/> <attr name="sLeftTopTextMarginLeft" format="dimension"/> <attr name="sLeftBottomTextMarginLeft" format="dimension"/> <attr name="sLeftBottomTextMarginLeft2" format="dimension"/> <attr name="sRightIconMarginRight" format="dimension"/> <attr name="sRightTextMarginRight" format="dimension"/> <attr name="sRightCheckBoxMarginRight" format="dimension"/> <attr name="sRightCheckBoxShow" format="boolean"/> <attr name="sIsChecked" format="boolean"/> <attr name="sUseRipple" format="boolean"/> <attr name="sLeftTextSize" format="dimension"/> <attr name="sLeftTopTextSize" format="dimension"/> <attr name="sLeftBottomTextSize" format="dimension"/> <attr name="sLeftBottomTextSize2" format="dimension"/> <attr name="sRightTextSize" format="dimension"/> <attr name="sCenterTextSize" format="dimension"/> <attr name="sBackgroundColor" format="color"/> <attr name="sLeftTextColor" format="color"/> <attr name="sLeftTopTextColor" format="color"/> <attr name="sLeftBottomTextColor" format="color"/> <attr name="sLeftBottomTextColor2" format="color"/> <attr name="sRightTextColor" format="color"/> <attr name="sCenterTextColor" format="color"/> <attr name="sLineShow" format="enum"> <enum name="none" value="0"/> <enum name="top" value="1"/> <enum name="bottom" value="2"/> <enum name="both" value="3"/> </attr></declare-styleable>
1 0
- 一个功能强大的 TextView,可以满足日常大部分布局方式,开发者可已自行组合属性配置出属于自己风格的样式!
- 一个功能强大的JAVA格状布局管理器
- 自定义简单的Toast,可自行修改文字、图片、样式
- 一个属于自己的网站
- 打印出一个字符串的所有组合的递归方式
- 自己实现一个可以折叠展开的TextView
- Relativelayout布局属性大全,包含大部分的属性解释
- SlidingMenu的使用详解(可以满足大部分的使用要求)
- CSS样式有哪些常用的属性?功能强大!
- 疯狂音乐—你的掌上音乐教师,在这里,人人都可以掌握属于自己风格的音乐。
- bash —— bind ( 一个功能强大的组合键! Alt + . )
- Web上功能强大的DbGrid表格HTC组件[只需在Table中指定样式就可以完成多种功能可扩展]
- 做一个属于自己的照片编辑器
- 制作一个属于自己的CocoaPods文件!
- 如何创建属于自己的一个论坛
- 一步步打造一个属于自己的RecyclerView
- 定义一个属于自己的Toast
- 拥有一个属于自己的博客吧
- 数据结构实验之二叉树四:还原二叉树
- binlog日志解析
- —五分钟理解一致性哈希算法(consistent hashing)
- unity性能优化
- 浅谈MVC与MVP的区别
- 一个功能强大的 TextView,可以满足日常大部分布局方式,开发者可已自行组合属性配置出属于自己风格的样式!
- HDU 5889 Barricade(最短路spfa+最大流dinic)
- Linux 用户及文件权限管理
- 窗口兼容性问题的一些小总结
- 使用vs动静态库生成与调用
- opencv项目中常见问题总结
- metrics
- 高效的计算素数的算法--埃氏筛法
- RTCP协议详解