Spinner Android在不同的sdks中显示不同的显示

时间:2014-12-10 13:47:20

标签: android styles android-spinner android-4.4-kitkat android-5.0-lollipop

我有一个简单的微调代码,在我的电脑中 Android API 更新为棒棒糖,而我的同事PC则更新为 kitkat ,但用户界面显示如下,为什么会发生这种情况

棒棒糖

lollipop

奇巧

Kitkat

activity.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>

Style.xml

<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>

1 个答案:

答案 0 :(得分:0)

您可以尝试在微调器的样式定义中定义自定义背景。您可以按照instructions

进行操作