我最近更新了我的应用程序的targetSdkVersion和appcompat到v23(Android 6.0 Marshmallow)之后这个更新evertyhing工作正常,除了在Android 2.3姜饼,微调器没有在对话框上显示内容,它显示在黑暗的下拉背景物品不可见的地方。
styles.xml
<resources>
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/Color_500</item>
<item name="colorPrimaryDark">@color/Color_700</item>
<item name="android:windowFullscreen">true</item>
</style>
</resources>
喷丝
<Spinner
android:id="@+id/replayspin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:clickable="true"
android:contentDescription="@string/Replay_prompt"
android:entries="@array/Replay_arrays"
android:prompt="@string/Replay_prompt"/>
Android 2.3 Gingerbread上的示例图片
答案 0 :(得分:0)
我有一个类似的问题,在我的情况下,原来是因为我在我的ArrayAdapter中使用了一个android.layout.xxx布局:
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
如果这就是你正在做的事情,那么尝试在你的项目中创建一个新的布局,并在我的情况下复制Android SDK提供的布局:
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/spinnerDropDownItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="?android:attr/dropdownListPreferredItemHeight"
android:ellipsize="marquee"/>
然后,您需要将样式属性更改为style="?spinnerDropDownItemStyle"
- 它使用appcompat主题中设置的spinnerDropDownItemStyle
,而不是android:spinnerDropDownItemStyle
。
您还需要更改layout_height,因为?android:attr/dropdownListPreferredItemHeight
不可见。我使用了android:layout_height="?dropdownListPreferredItemHeight"
。