From ddd54dd5e143067a6f01413fa0a08c6004a3f951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=96=9B=E5=B0=8F=E9=BE=99?= Date: Thu, 24 Nov 2016 17:45:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=E8=8E=B7=E5=BE=97?= =?UTF-8?q?=E5=BC=80=E5=85=B3=E7=9A=84=E7=8A=B6=E6=80=81=E5=92=8C=E7=94=A8?= =?UTF-8?q?=E5=B8=83=E5=B0=94=E5=80=BC=E6=8E=A7=E5=88=B6=E5=BC=80=E5=85=B3?= =?UTF-8?q?=E7=9A=84=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/zcw/togglebutton/ToggleButton.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/togglebutton-library/src/com/zcw/togglebutton/ToggleButton.java b/togglebutton-library/src/com/zcw/togglebutton/ToggleButton.java index 8755ca6..5baa2f5 100644 --- a/togglebutton-library/src/com/zcw/togglebutton/ToggleButton.java +++ b/togglebutton-library/src/com/zcw/togglebutton/ToggleButton.java @@ -324,5 +324,15 @@ public boolean isAnimate() { public void setAnimate(boolean animate) { this.defaultAnimate = animate; } - + public void setChecked(boolean isChecked){ + if (isChecked){ + toggle(); + }else { + toggleOff(); + } + } + + public boolean isChecked(){ + return toggleOn; + } }