Android: How to create slide (on/off) button
问题 I'd like to create a slide button (= something as switch ) with two states: on and off so user will have to press the button and slide it to change the state (something similar as unlock slider but not cross whole screen). Do you have any idea how to do it? I really tried to find the answer but I haven't been successful. Thanks a lot! 回答1: //in your layout design the below line <RelativeLayout android:layout_width="wrap_content" android:id="@+id/rl_onoff" android:layout_height="wrap_content">