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:

How can I do that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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