2

Possible Duplicate:
Android: How to create slide (on/off) button

I want to create sliding button in my Android application such that it will look like the following:

enter image description here

How can I do that?

Community
  • 1
  • 1
void pointer
  • 575
  • 2
  • 8
  • 20
  • 2
    Update: [**Switch widget**](http://developer.android.com/reference/android/widget/Switch.html) is also there. – Paresh Mayani Jun 29 '12 at 10:40
  • Please see Below links for make custom toggle button. [Link 1](http://stackoverflow.com/questions/9938315/toggle-button-in-iphone-style) [Link 2](http://www.mokasocial.com/2011/07/sexily-styled-toggle-buttons-for-android/) – Dipak Keshariya Jun 29 '12 at 10:40

1 Answers1

5

Use ToggleButton for creating this sliding button

see this tutorial for Creating Custom ToggleButton in Android

Sexily Styled Toggle Buttons for Android (archive.org mirror)

EDIT : if you are using Android API LEVEL 14 or above then you can also use Switch Widget for creating sliding button see this example :

Creating a Switch

Edward Falk
  • 9,991
  • 11
  • 77
  • 112
ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213