Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 906 Bytes

README.md

File metadata and controls

30 lines (22 loc) · 906 Bytes

This is a library project with a custom view that implements open&close function same as CheckBox.This implements the concept of switch(https://dribbble.com/shots/1376110-iOS7-Swith-free-After-Effects-file?list=likes&offset=0)made by Jelio Dimitrov.

###Demo###

demo

###Usage###

Add the SwitchView in your layout.

<com.zhanglei.customizeview.SwitchView
        android:id="@+id/switch_button"
        android:layout_centerInParent="true"
        android:layout_width="150dp"
        android:layout_height="100dp" />

and

switchButton.setOnCheckedChangeListener(new SwitchView.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(View view, boolean isChecked) {
                Toast.makeText(MainActivity.this, "isChecked: " + isChecked,
                 Toast.LENGTH_LONG).show();
            }
        });