Spinner showing items as Drop Down List

2019-05-23 21:23发布

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
this
but I am getting this:
this http://i50.tinypic.com/9zr1vm.png
& 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条回答
姐就是有狂的资本
2楼-- · 2019-05-23 21:53

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

查看更多
登录 后发表回答