【问题标题】:Spinner Android Showing different display in Different sdksSpinner Android 在不同的 sdks 中显示不同的显示
【发布时间】:2015-02-08 17:49:55
【问题描述】:

我有一个简单的微调器代码,在我的 PC 中 Android API 更新为 lollipop 而我的同事 PC 更新为 kitkat,但 UI显示如下,为什么会这样

棒棒糖

奇巧

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>

【问题讨论】:

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


    【解决方案1】:

    您可以尝试在微调器的样式定义中定义自定义背景。你可以关注这个instructions

    【讨论】:

    • 我不是在问如何创建微调器,为什么这个视图会更改为 api?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-31
    • 1970-01-01
    • 1970-01-01
    • 2015-05-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多