gpt4 book ai didi

android - 自定义复选框样式

转载 作者:行者123 更新时间:2023-11-30 03:42:20 25 4
gpt4 key购买 nike

我在 http://android-holo-colors.com/ 上为我的 android 应用程序创建了一些样式.我已经下载它并将其解压缩到我的 res 文件夹中,但我无法管理它以应用复选框的样式。这是我在自定义主题中所做的。

<style name="CustomTheme" parent="Theme.Sherlock.Light">
...
<item name="android:checkboxStyle">@style/CheckBoxAppTheme</item>
...
</style>

我应用的样式是android-holo-colors生成的,所以我觉得错误应该不是这个样式。有没有人看到我做错了什么?顺便提一句。主题应用于应用程序。

更新:

为了更清楚,我也将发布样式代码。

<style name="CheckBoxAppTheme" parent="android:Widget.CompoundButton.CheckBox">
<item name="android:button">@drawable/btn_check_holo_light</item>
</style>

那里使用的 drawable 有一个看起来像这样的选择器:

<selector xmlns:android="http://schemas.android.com/apk/res/android">

<!-- Enabled states -->

<item android:state_checked="true" android:state_window_focused="false"
android:state_enabled="true"
android:drawable="@drawable/btn_check_on_holo_light" />
<item android:state_checked="false" android:state_window_focused="false"
android:state_enabled="true"
android:drawable="@drawable/btn_check_off_holo_light" />

<item android:state_checked="true" android:state_pressed="true"
android:state_enabled="true"
android:drawable="@drawable/btn_check_on_pressed_holo_light" />
<item android:state_checked="false" android:state_pressed="true"
android:state_enabled="true"
android:drawable="@drawable/btn_check_off_pressed_holo_light" />

<item android:state_checked="true" android:state_focused="true"
android:state_enabled="true"
android:drawable="@drawable/btn_check_on_focused_holo_light" />
<item android:state_checked="false" android:state_focused="true"
android:state_enabled="true"
android:drawable="@drawable/btn_check_off_focused_holo_light" />

<item android:state_checked="false"
android:state_enabled="true"
android:drawable="@drawable/btn_check_off_holo_light" />
<item android:state_checked="true"
android:state_enabled="true"
android:drawable="@drawable/btn_check_on_holo_light" />

<!-- Disabled states -->

<item android:state_checked="true" android:state_window_focused="false"
android:drawable="@drawable/btn_check_on_disabled_holo_light" />
<item android:state_checked="false" android:state_window_focused="false"
android:drawable="@drawable/btn_check_off_disabled_holo_light" />

<item android:state_checked="true" android:state_focused="true"
android:drawable="@drawable/btn_check_on_disabled_focused_holo_light" />
<item android:state_checked="false" android:state_focused="true"
android:drawable="@drawable/btn_check_off_disabled_focused_holo_light" />

<item android:state_checked="false"
android:drawable="@drawable/btn_check_off_disabled_holo_light" />
<item android:state_checked="true"
android:drawable="@drawable/btn_check_on_disabled_holo_light" />

</selector>

那里使用的所有可绘制对象都是 .png 文件。

最佳答案

您是否在 AndroidManifest.xml 中更改了您的应用主题?

关于android - 自定义复选框样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15531164/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com