简体   繁体   中英

How do i hide the selected item of spinner

I have a spinner on right side of action bar, and i am using a background draw-able for my spinner. when i click on that draw-able, drop-down list appears with spinner items, and when i select a spinner item, it starts showing at the action bar, i don't want it to show there at the title bar. how can i do that. Below is the code for my spinner

<Spinner
    android:id="@+id/planets_spinner"
    android:layout_width="40sp"
    android:layout_height="35sp"
    android:focusable="false"
    android:layout_alignParentRight="true"
    android:background="@drawable/arrow"
    android:layout_alignParentTop="true" />

I have a spinner like this

在此处输入图片说明

On Item selection, i want it to be like this

在此处输入图片说明

but the selected item's name keeps on appearing like this

在此处输入图片说明

You can play with the spinner adapter, changing the text of the spinner item when it is selected to be blank, and restoring it once it is unselected. This isn't the most graceful solution, but it will give you what you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM