Apply tint to PreferenceActivity widgets with AppCompat v21

前端 未结 5 1281
失恋的感觉
失恋的感觉 2020-12-23 15:24

I\'m using CheckboxPreference in a PreferenceActivity and an AppCompat theme from the v21 support library. As you already know, with this latest library widgets like checkbo

5条回答
  •  隐瞒了意图╮
    2020-12-23 15:37

    So far, my own (sad) workaround was to create from scratch my own checkbox drawables, using the colors which the checkbox should have been tinted with in the first place.

    In styles.xml:

    
    
    

    drawable/my_checkbox.xml:

    
    
        
        
    
    

    checkbox_on" andcheckbox_off` are the PNG drawables for the selected and unselected states, obviously one for each screen density. If you mind dimension consistency, the baseline (MDPI) dimension of the drawables should be 32px full asset and 18px optical square.

提交回复
热议问题