switchView

Project Url: 799536960/switchView
Introduction: 带有文字的 switch
More: Author   ReportBugs   
Tags:
switch-button-

<com.duma.ld.mylibrary.SwitchView
        android:layout_width="200dp"
        android:layout_height="50dp"
        app:time="500"//动画时间
        app:bgColor="#FFE0B2"//背景色
        app:leftColor="#8cc152"//左边颜色
        app:rightColor="#757575"//右边颜色
        app:setChecked="true"//true 是在右边 反之
        app:textLeft="预约车位"//左边 text
        app:textLeftColor="#8cc152"//左边字的颜色
        app:textLeftClickColor="#757575"//左边字选中后颜色 默认白
        app:textRight="我有车位"//同上
        app:textRightClickColor="#FFE0B2"//同上
        app:textRightColor="#8cc152" />//同上

用法

compile 'com.ld:switchView:1.1.7'

点击监听

  switchView.setOnClickCheckedListener(new SwitchView.onClickCheckedListener() {
            @Override
            public void onClick() {
                Toast.makeText(MainActivity.this, "type:" + switchView.isChecked(), Toast.LENGTH_SHORT).show();
            }
        });

有问题需要 欢迎留言~

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools