SuperTextView
来源:互联网 发布:淘宝源码 编辑:程序博客网 时间:2024/06/05 19:19
SuperTextView 是TextView的升级版,可以实现TextView的全部功能,但SuperTextView比TextView的功能更加强大,在此空间中可以将文字,图片,其他控件(如CheckBox)等。
先来看一下效果
一.在module的build.gradle中添加依赖
compile 'com.allen.supertextview:supertextview:1.0.1'
二.XML布局
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" xmlns:stv="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="zhiyuan3g.com.mysupertextview.MainActivity"> <com.allen.supertextviewlibrary.SuperTextView android:id="@+id/main_super_textView" android:layout_width="match_parent" android:layout_height="100dp" stv:sLeftBottomTextString="招商银行8888" stv:sLeftBottomTextString2="限额说明" stv:sLeftIconRes="@drawable/bank" stv:sLeftTopTextString="银行卡支付" stv:sRightCheckBoxRes="@drawable/circle_false" stv:sRightCheckBoxShow="true" stv:sLineShow="top" > </com.allen.supertextviewlibrary.SuperTextView></RelativeLayout>
三.Java代码
public class MainActivity extends AppCompatActivity { private SuperTextView superTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); superTextView= (SuperTextView) findViewById(R.id.main_super_textView); //设置其一些属性 superTextView.setCbChecked(true) .setLeftBottomString("建设银行");// .setLeftString("hahaha")// .setLeftTVColor(10);// .setLeftTopString("")// .setLeftTopTVColor(Color.GREEN);// .setLeftBottomString("")// .setLeftBottomTVColor(0)// .setLeftBottomString2("")// .setLeftBottomTVColor2(0)// .setRightString("")// .setRightTVColor(0)// .setCbChecked(true)// .setRightString("")// .setRightTVColor(0)// .setLeftString(""); //设置监听器 superTextView.setOnSuperTextViewClickListener(new SuperTextView.OnSuperTextViewClickListener(){ //点击整个SuperTextView时回调 @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 } }); }}
0 0
- superTextView
- SuperTextView
- SuperTextView
- SuperTextView
- SuperTextView
- superTextView 万能的TextView
- 欢迎使用SuperTextView
- SuperTextView遇到的坑
- SuperTextView 强大的textView
- SuperTextView多形态控件
- 从未如此惊艳!你好,SuperTextView
- 从未如此惊艳!你好,SuperTextView
- 从未如此惊艳!你好,SuperTextView
- Android快速开发之SuperTextView
- SuperTextView:一款强大的TextView
- 一个神奇的SuperTextView你值得拥有!
- SuperTextView 一款强大的android TextView
- 【实战】SuperTextView:一款强大的TextView
- PHP排序函数-根据指定字段将数组排序
- git checkout到历史某个版本
- jmx连接远程服务器
- Adobe Dreamweaver CS5安装步骤
- Android——Activity的四种启动模式
- SuperTextView
- 英文版Ubuntu16.04安装fcitx-googlepinyin
- 一般处理程序中使用Session
- 逻辑回归
- js-window对象的方法和属性资料
- Mysql中设置默认时间为系统当前时间
- 混合app打包步骤(本地+云端)HybirdApp本地环境配置步骤
- obs-studio源码阅读笔记:学习obs流程的第一步,test程序
- vim命令总结