Spinner Android在不同SDK中显示不同的显示
我有一个简单的微调器代码,在我的电脑中,安卓API被更新为棒棒糖,我的同事电脑的kitkat,但用户界面显示如下,为什么会发生这种情况 棒棒糖 Kitkat activity.xmlSpinner Android在不同SDK中显示不同的显示,android,styles,android-spinner,android-4.4-kitkat,android-5.0-lollipop,Android,Styles,Android Spinner,Android 4.4 Kitkat,Android 5.0 Lollipop,我有一个简单的微调器代码,在我的电脑中,安卓API被更新为棒棒糖,我的同事电脑的kitkat,但用户界面显示如下,为什么会发生这种情况 棒棒糖 Kitkat activity.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#cfcfcf"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical">
<Spinner
android:id="@+id/spinner1"
android:layout_width="match_parent"
android:entries="@array/arr"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
<item name="android:spinnerItemStyle">@style/mySpinnerItemStyle</item>
<item name="android:spinnerDropDownItemStyle">@style/mySpinnerItemStyle</item>
</style>
<style name="mySpinnerItemStyle" parent="@android:style/Widget.Holo.DropDownItem.Spinner">
<item name="android:textSize">15sp</item>
<item name="android:textColor">#00ff00</item>
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
Style.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#cfcfcf"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical">
<Spinner
android:id="@+id/spinner1"
android:layout_width="match_parent"
android:entries="@array/arr"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
<item name="android:spinnerItemStyle">@style/mySpinnerItemStyle</item>
<item name="android:spinnerDropDownItemStyle">@style/mySpinnerItemStyle</item>
</style>
<style name="mySpinnerItemStyle" parent="@android:style/Widget.Holo.DropDownItem.Spinner">
<item name="android:textSize">15sp</item>
<item name="android:textColor">#00ff00</item>
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
@样式/mySpinnerItemStyle
@样式/mySpinnerItemStyle
15便士
#00ff00
您可以尝试在微调器的样式定义中定义自定义背景。您可以按照此操作我不是在问如何创建微调器,为什么api的视图会改变?