Slide Toggle for Android

后端 未结 4 1022
醉酒成梦
醉酒成梦 2020-11-30 03:38

Anyone know of any open source implementation of a slide toggle for android. The default android toggle(ToggleButton) is not pretty. I am looking for anything similar to iOS

4条回答
  •  Happy的楠姐
    2020-11-30 03:42

    you can use the sliding drawer widget in android to have a sliding toggle switch. you just have to "slice" the ios toggle images into3 parts, one for the handle, one for the sliding drawer background and one for the content part. then put an image on top of it like a frame to give you the "round edges"

    here's what i've come up with: XML Layout

    
    
        
            
                
                
            
            
        
    
    

    ios_retina_toggle_on_full
    ios_retina_toggle_on_full.png

    ios_retina_toggle_button
    ios_retina_toggle_button.png

    ios_retina_toggle_off
    ios_retina_toggle_off.png

    ios_retina_toggle_frame
    ios_retina_toggle_frame.png

    and finally a screenshot of how it looked on the emulator on a 3.7 WVGA screen running gingerbread: enter image description here

提交回复
热议问题