选取器按钮的颜色在android 5.1上未更改 [英] Picker button's color not changing on android 5.1

查看:79
本文介绍了选取器按钮的颜色在android 5.1上未更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来更改我的自定义选择器的确定"和取消"按钮的颜色.我将此代码添加到android项目的样式文件中:

I was searching for a way to change the colors of the ok and cancel button of my custom picker. I added this code to the styles file on the android project:

<style name="SpinnerDialog" parent="Theme.AppCompat.Light.Dialog">
    <item name="android:popupBackground">#039BE5</item>
    <item name="colorPrimary">#039BE5</item>
    <item name="colorPrimaryDark">#039BE5</item>
    <item name="colorAccent">#039BE5</item>
  </style>

我在小米POCOPHONE F1(Android v9)和2个模拟器(Android v8.1)上运行了应用程序,颜色发生了变化,并且一切正常,我尝试将应用程序部署在平板电脑(Android v5.1)上没变!

I run the app on my Xiaomi POCOPHONE F1 (Android v9) and on 2 emulators (Android v8.1) the color changed and everything worked fine, I tried deploying the app on my tablets (Android v5.1) the colors didn't change!!

我想念什么吗?

推荐答案

如果您想为对话框使用样式,则可以尝试以下方法:

if you want to use style for the dialog ,you could try this:

以您的主题样式:

<item name="android:alertDialogTheme">@style/SpinnerDialog</item>

然后使用自定义对话框样式:

then custom dialog style:

<style name="SpinnerDialog"
     parent="android:Theme.Material.Light.Dialog.Alert">
<item name="android:colorAccent">#039BE5</item>

这篇关于选取器按钮的颜色在android 5.1上未更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆