Spinner showing items as Drop Down List

拟墨画扇 提交于 2019-12-07 22:17:43

问题


I have made a spinner in an activity getting called inside a tab layout.
The problem is that the items (3 in nos.) are being showing in a separate dialog as in case of a drop down list and not as a spinner.

I followed this example. And as shown the picture I was expecting


but I am getting this:

& this

.

I want to show just 3 items inside the spinner and do not want the new dialog for the items to be selected. And I have tried my code both on 2.3.3 and 4.0.3 emulators.

Any suggestions?
Thanks

回答1:


spinner as a dropdown is of HOLO Theme. first image is of HOLO Theme and 2nd and 3rd is not.. holo theme is supported since api level 11..

if you want to apply Holo Theme. set

<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" />

and styles.XML inside values-v11 folder

<resources>

<!--
    Base application theme for API 11+. This theme completely replaces
    AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
    <!-- API 11 theme customizations can go here. -->
</style>

and styles.XML inside values folder

<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="android:Theme.Light.NoTitleBar">
    <!--
        Theme customizations available in newer API levels can go in
        res/values-vXX/styles.xml, while customizations related to
        backward-compatibility can go here.
    -->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>


 <style name="progressbar_holo" parent="@android:style/Theme.Light">
</style>

and in AndroidMeanifeast.xml

android:theme="@style/AppTheme"

in application TAG.

OR follow this 2 links 1. https://github.com/ChristopheVersieux/HoloEverywhere
2. https://github.com/ChristopheVersieux/HoloEverywhere



来源:https://stackoverflow.com/questions/14214001/spinner-showing-items-as-drop-down-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!