Android 更改微调器按下颜色 Light Holo 主题

发布于 2024-12-29 10:14:33 字数 125 浏览 3 评论 0原文

我正在开发 Android 平板电脑应用程序。我创建了一个自定义操作栏,并设法按照我想要的方式设置其样式,除了旋转器之外。

我的主题扩展了 Holo Light,这意味着当我按下旋转器时,它会变成蓝色。我该如何改变这个?

I am working on an Android Tablet app. I have created a custom action bar, and managed to style it the way I want, except for the spinners.

My main theme extends Holo Light meaning that when I press a spinner it goes blue. How do I change this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

行雁书 2025-01-05 10:14:33

在主题中为 android:actionDropDownStyle 指定自定义样式,该样式本身具有用于自定义状态列表可绘制对象的 android:background

以下是默认指定的图像:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false"
          android:drawable="@drawable/spinner_ab_disabled_holo_dark" />
    <item android:state_pressed="true"
          android:drawable="@drawable/spinner_ab_pressed_holo_dark" />
    <item android:state_pressed="false" android:state_focused="true"
          android:drawable="@drawable/spinner_ab_focused_holo_dark" />
    <item android:drawable="@drawable/spinner_ab_default_holo_dark" />
</selector>

您需要为其中每一种状态(以及 mdpi、hdpi 和 xhdpi)提供自己的图像。

您可以修改平台附带的内容,让您的生活更轻松。查看SDK/platforms/platform-14/data/res/中的drawable-mdpidrawable-hdpidrawable -xhdpi 文件夹。

Specify a custom style for android:actionDropDownStyle in your theme which itself has an android:background for your custom state-list drawable.

Here's the one that's specified by default:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false"
          android:drawable="@drawable/spinner_ab_disabled_holo_dark" />
    <item android:state_pressed="true"
          android:drawable="@drawable/spinner_ab_pressed_holo_dark" />
    <item android:state_pressed="false" android:state_focused="true"
          android:drawable="@drawable/spinner_ab_focused_holo_dark" />
    <item android:drawable="@drawable/spinner_ab_default_holo_dark" />
</selector>

You'll need to provide your own images for each one of these states (and for mdpi, hdpi, and xhdpi).

You can modify the ones that come with the platform to make your life easier. Look in SDK/platforms/platform-14/data/res/ in the drawable-mdpi, drawable-hdpi, and drawable-xhdpi folders.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文