我遇到一个问题,我使用的微调器在模拟器中显示正确,但在手机上显示不正确。
从手机截取的屏幕截图可以最好地说明这一点(请注意“App Priorities 1”字样后面的浅灰色背景):
它应该看起来像这样(取自模拟器)。这是文本应该是白色的,背景是黑色的。
我不确定代码的所有相关部分是什么,但我有一个名为 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 后,模拟器和手机的行为一致。操作栏现在应该是黑色的。但是所有列表都有白色背景!
最佳答案
将 AppTheme
更改为 Theme.Holo
而不是 Theme.Holo.Light.DarkActionBar
,您将恢复深色背景。
Theme.Holo.Light.DarkActionBar
与 Theme.Holo.Light
(浅色所有内容)相同,您猜对了,只是一个较暗的 操作栏
。
关于android - Action Bar 中 Spinner 的主题在模拟器中正确显示,但在手机上显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12535931/