EGH*_*HDK 13 java xml android android-theme android-styles
我正在尝试更改Android中交换机的颜色.我意识到我需要新的9件.我去了http://android-holo-colors.com/并选择了我的颜色并选择了(Switch Jelly Bean).要使用Switch Jelly Bean,我必须使用:https://github.com/BoD/android-switch-backport.要将它导入我的项目,我必须添加:
<item name="switchStyle">@style/Widget.Holo.CompoundButton.Switch</item>
到我的样式,然后在xml我必须像这样使用开关:
<org.jraf.android.backport.switchwidget.Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
现在用开关的一切工作正常.接下来,我从android全息颜色生成器输出所有内容并将其放入正确的文件中:
然后我添加到我的xml:
<org.jraf.android.backport.switchwidget.Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:thumb="@drawable/apptheme_switch_inner_holo_light"
android:track="@drawable/apptheme_switch_track_holo_light" />
但它仍然是原始的蓝色.我相信我正在做的一切正确.一切都编译(xml,java).注意:我org.jraf.android.backport.switchwidget.Switch也在我的java中导入.有任何想法吗?
在Android Lollipop及更高版本中最简单的方法,
<style name="AppTheme" parent="MaterialTheme.Light">
...
<item name="android:colorControlActivated">@color/color_switch</item>
</style>
Run Code Online (Sandbox Code Playgroud)