问题描述
AppCompat v21似乎提供了SwitchCompat,却没有提供SwitchCompatPreference.
It seems AppCompat v21 provides SwitchCompat does not provide SwitchCompatPreference.
我知道我可以使用SwitchPreference,但外观上并不相同.在Android 4.x上;当我在活动界面上使用v21中的SwitchCompact时,它看起来像是材质切换按钮,但是,因为没有SwitchCompactPreference,所以我必须在首选项视图中使用SwitchPreference,并且显然它具有Android 4.0外观.
I know I can use SwitchPreference but it is not visually identical. On Android 4.x; when I use SwitchCompact from v21 on activity interface, it looks like material switch button, but, because there is no SwitchCompactPreference I have to use SwitchPreference in my preference view and obviously it has Android 4.0 look.
AppCompact v21似乎已完成一半.
It looks like AppCompact v21 half complete.
我想念什么吗?
推荐答案
这是一个代码段,即使在较旧的版本上也显示了材料开关. https://gist.github.com/cgollner/5b31123c98b2c1cad8dc https://gist.github.com/cgollner/3c7fe2f9d34aee38bd0c
Here is a code snippet displaying material Switches even on older versions.https://gist.github.com/cgollner/5b31123c98b2c1cad8dchttps://gist.github.com/cgollner/3c7fe2f9d34aee38bd0c
参考: https://plus.google.com/118168530059850940658/posts/badausxo1J6
这篇关于Android AppCompat v21提供的SwitchCompat不提供SwitchCompatPreference的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!