第三方开源库之 SuperTextView

一、前言:

SuperTextView 是一个功能强大的 View,可以满足日常大部分布局样式,开发者可已自行组合属性配置出属于自己风格的样式!可能描述起来没有概念,还是直接看效果图吧!

1. 效果图:

第三方开源库之 SuperTextView_第1张图片
image.png
第三方开源库之 SuperTextView_第2张图片
image.png
第三方开源库之 SuperTextView_第3张图片
image.png
第三方开源库之 SuperTextView_第4张图片
image.png
第三方开源库之 SuperTextView_第5张图片
image.png
第三方开源库之 SuperTextView_第6张图片
image.png

2. 如何使用

Android Studio导入方法,添加Gradle依赖
先在项目根目录的 build.gradle 的 repositories 添加:

allprojects {
         repositories {
            ...
            maven { url "https://jitpack.io" }
        }
    }

然后在dependencies添加:

 dependencies {
        ...
        compile 'com.github.lygttpod:SuperTextView:1.1.2'
        }

2.1 布局中如何使用


        注意:
                1、上下的线可以通过   sLineShow 设置  有四种显示方式 none,top,bottom,both
                2、通过设置 sUseRipple=true 开启水波效果

示例:




    

        

            

            

            

            

            

            

            
        
    


2.2 代码中如何使用:

 /**
     * 可以通过链式设置大部分常用的属性值
     */
        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("")

//点击事件:
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
                    }
                });

                注意:点击事件需要配合属性值使用
                sLeftTopViewIsClickable= true
                sLeftBottomViewIsClickable= true
                sLeftBottomView2IsClickable= true

2.3 属性说明

第三方开源库之 SuperTextView_第7张图片
image.png
第三方开源库之 SuperTextView_第8张图片
image.png

3. 效果图的布局:

activity_demo_one.xml




    

        

            

            

            

            

            

            

            
        
    


activity_demo_two.xml




    
    
    

    
    
    


activity_demo_three.xml




    

    

    

    


activity_demo_four.xml




    

    

    

    

    

    

activity_demo_five.xml




    

    

    

    
    
    


activity_demo_six.xml




    

    

    



参考链接:https://www.jianshu.com/p/8835227e78b6

你可能感兴趣的:(第三方开源库之 SuperTextView)