Android switches - making thumb height larger than track height, how?

后端 未结 4 1372
北荒
北荒 2020-12-18 03:53

Is there any way to make the height of the thumb of a switch bigger than the track height in Android versions prior to Lollipop ?

I am essentially trying to create a

4条回答
  •  难免孤独
    2020-12-18 04:57

    The solution I came up with is just to use for the track a shape that is a line instead of a rectangle, and set the width explicitly in its stroke.

    For example if the switch is defined as follows:

            
    

    The in the switch_track.xml drawable use a line shape with whatever width you desire:

    
    
        
            
                
            
        
        
            
                
            
        
    
    

提交回复
热议问题