简体   繁体   English

在android中设计自定义切换按钮

[英]design custom toggle button in android

Can any body please tell me how to design the custom toggle button.任何人都可以告诉我如何设计自定义切换按钮。

在此处输入图片说明

Firstly remeber you must have 9 patch your image to make theme reponsive along all devices.首先请记住,您必须有9 个补丁才能使主题响应所有设备。

Also you should have different image for thumb and track .你也应该有不同的拇指和轨道图像

then in this way you can make the similar sliding switch那么这样你就可以做出类似的滑动开关

<Switch android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:thumb="@drawable/thumb_blue"
                android:track="@drawable/track_grey"
                android:textOn="Male"
                android:textOff="Female"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM