How to change the track color of a SwitchCompat

后端 未结 10 1836
孤城傲影
孤城傲影 2020-11-29 18:01

I\'ve tried using the following link to change the color of a SwitchCompat:

How to change the color of a SwitchCompat

Notice the low constrast in my switch:<

10条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 18:17

    Here is how a developer can change the track drawable of a SwitchCompat:
    First, in the root layout, write xmlns:SwitchCompat="http://schemas.android.com/apk/res-auto"
    Then:

        
    

    where your_switch_track_selector can be:

    
        
        
    
    
    1.switch_ios_track_on:
    
        
        
    
    
    2.switch_ios_track_off:
    
        
        
    
    

    Simple and easy..

提交回复
热议问题