Android toggle button custom look

后端 未结 4 1356
刺人心
刺人心 2020-11-27 05:44

I\'ve been trying to customize the toggle button look but with no success. Here is how I want it to look like:

\

4条回答
  •  半阙折子戏
    2020-11-27 06:02

    I think you need to define a custom background for your button. Take a look at the Developer Guide on customizing a Button's background.

    However, in step Three, Create a new XML file in the res/drawable/ directory Use this Xml:

    
    
        
        
    
    

    The element android:state_checked="true" is what defines that state as the checked background.

    Let me know if this works for you.

提交回复
热议问题