summaryrefslogtreecommitdiff
path: root/core/java/android/widget/Switch.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/widget/Switch.java')
-rw-r--r--core/java/android/widget/Switch.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java
index 23e55e2be2fa..507d73a9a687 100644
--- a/core/java/android/widget/Switch.java
+++ b/core/java/android/widget/Switch.java
@@ -359,6 +359,17 @@ public class Switch extends CompoundButton {
}
/**
+ * Set the drawable used for the track that the switch slides within.
+ *
+ * @param track Resource ID of a track drawable
+ *
+ * @attr ref android.R.styleable#Switch_track
+ */
+ public void setTrackResource(int resId) {
+ setTrackDrawable(getContext().getResources().getDrawable(resId));
+ }
+
+ /**
* Get the drawable used for the track that the switch slides within.
*
* @return Track drawable
@@ -383,6 +394,18 @@ public class Switch extends CompoundButton {
}
/**
+ * Set the drawable used for the switch "thumb" - the piece that the user
+ * can physically touch and drag along the track.
+ *
+ * @param thumb Resource ID of a thumb drawable
+ *
+ * @attr ref android.R.styleable#Switch_thumb
+ */
+ public void setThumbResource(int resId) {
+ setThumbDrawable(getContext().getResources().getDrawable(resId));
+ }
+
+ /**
* Get the drawable used for the switch "thumb" - the piece that the user
* can physically touch and drag along the track.
*