android - Action Bar 中 Spinner 的主题在模拟器中正确显示,但在手机上显示错误

标签 android android-actionbar android-spinner android-theme

我遇到一个问题,我使用的微调器在模拟器中显示正确,但在手机上显示不正确。

从手机截取的屏幕截图可以最好地说明这一点(请注意“App Priorities 1”字样后面的浅灰色背景):

Incorrect spinner theme displayed on phone

它应该看起来像这样(取自模拟器)。这是文本应该是白色的,背景是黑色的。

Correct spinner theme displayed on emulator

我不确定代码的所有相关部分是什么,但我有一个名为 values-v14 的文件夹,其中包含一个名为 styles.xml 的文件.该文件的内容是:

<resources>
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar" />
</resources>

这是微调器 XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="fill_horizontal"
android:orientation="vertical" >

<TextView  
    android:id="@android:id/text1"
    style="?android:attr/spinnerItemStyle"      
    android:singleLine="true"
    android:layout_width="150dip"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:textAppearance="?android:attr/textAppearanceMedium"
 />

</RelativeLayout>

我不确定 list 是否相关,但我有这个: android:minSdkVersion="15" android:targetSdkVersion="15"

我尝试将版本设置为 14,但这没有任何区别。

更新:将 android:theme="@style/AppTheme" 添加到 list 后,模拟器和手机的行为一致。操作栏现在应该是黑色的。但是所有列表都有白色背景!

Now lists color are incorrect!

最佳答案

AppTheme 更改为 Theme.Holo 而不是 Theme.Holo.Light.DarkActionBar ,您将恢复深色背景。

Theme.Holo.Light.DarkActionBarTheme.Holo.Light(浅色所有内容)相同,您猜对了,只是一个较暗的 操作栏

关于android - Action Bar 中 Spinner 的主题在模拟器中正确显示,但在手机上显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12535931/

相关文章:

java - Android FFmpegMediaMetadataRetriever.getFrameAtTime() 很慢

java - 如何找到玩家上传数据中最大的值(value)

Android Action Bar 和 I/O 项目

android - 操作栏菜单项文本为大写

java - ActionBar 中的 SearchView 和 Activity 标题

android - 将 OnItemSelectedListener 添加到 Spinner

Android Appcompat v21 - 使用旧的微调器样式

javascript - 如何使用 Phonegap 打开 Twitter 和 Facebook 应用程序?

Android: Butter knife 无法在布局中找到并转换相应的 View

android - 如何更改打开的微调器的位置?