Android的微调用在深色背景上的黑色文本 [英] Android spinner with black text on a dark background

查看:109
本文介绍了Android的微调用在深色背景上的黑色文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于主题一款Android活动:

For an Android activity with theme:

     <android:theme="@android:style/Theme.Light.NoTitleBar">

和没有其他明确的颜色属性,在摩托罗拉DroidX(Android版本2.3.340.MB810.Verizon.en.US),微调和按钮背景是暗着黑色文本虽然主要背景是白色的。在大多数其他手机,微调和按钮显示为浅灰色渐变背景上的黑色文本。

and no other explicit colour properties, on a Motorola DroidX (Android version 2.3.340.MB810.Verizon.en.US), the spinner and button backgrounds are dark with black text although the main background is white. On most other phones, spinner and buttons appear as black text on a light grey gradient background.

我做得不对,也可能这算是Android或摩托罗拉的错误?

Am I doing something wrong, or might this be an Android or Motorola bug?

在任何情况下,任何人都可以提出一个很好的解决方法?

In any case, can anyone suggest a good workaround?

推荐答案

设计您自己的背景微调定制绘制,并适用于它。
对于spinnerbackground.xml图像可以从SDK参考图像。重建图像按您的设计要求。

Design you own customized drawable for spinner background and apply to it. For spinnerbackground.xml images you can refer the images from the SDK. recreate the images as per your design requirements

Android的SDK \\ \\平台Android的9 \\ DATA \\水库\\绘制,华电国际\\ *。PNG

"Android-sdk\platforms\android-9\data\res\drawable-hdpi\*.png"

spinnerbackground.xml

spinnerbackground.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:state_window_focused="false" android:state_enabled="true"
        android:drawable="@drawable/wlbtn_dropdown_normal" />
    <item
        android:state_window_focused="false" android:state_enabled="false"
        android:drawable="@drawable/wlbtn_dropdown_disabled" />
    <item
        android:state_pressed="true"
        android:drawable="@drawable/wlbtn_dropdown_pressed" />
    <item
        android:state_focused="true" android:state_enabled="true"
        android:drawable="@drawable/wlbtn_dropdown_selected" />
    <item
        android:state_enabled="true"
        android:drawable="@drawable/wlbtn_dropdown_normal" />
    <item
        android:state_focused="true"
        android:drawable="@drawable/wlbtn_dropdown_disabled_focused" />
    <item
        android:drawable="@drawable/wlbtn_dropdown_disabled" />
</selector>

然后微调窗口小部件应用自定义绘制:

then for spinner widget apply your custom drawable:

<Spinner android:background="@drawable/spinnerbackground"
         android:id="@+id/spinnerIDr"
         android:layout_height="wrap_content" 
         android:layout_width="fill_parent">
    </Spinner>

这篇关于Android的微调用在深色背景上的黑色文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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