The use of spinner controls in Android development

Source: Internet
Author: User

There are five common methods of spinner objects used in Android mobile app development.

Usage 1: Static display of Spinner options in resource mode

Usage 2: Dynamically display the Spinner option in code mode

usage 3 : Display pictures and text at the same time

Usage 4: Mixed mode

I'm just here. For the use of usage 1 and Usage 3, the other way can be referred to the following blog, written very well.

Http://www.cnblogs.com/freeliver54/archive/2012/09/03/2668363.html

The preceding declaration variables and initialization are no longer described. We directly learn the following methods of use.

Note The string selection information in the drop-down box is stored in the XML file in the Resource value folder

< string name = "Spin_prompt" > Please select expense type </string >          < String-array name = "Outaccount" >                    < it Em > Hydro </item >                    < item > Rent </item >                    < item > Taxi charge </item >                    < item ; Dietary costs </Item >                    < item > Other charges </item >          

If there is a return button, you can return the button to the event that is added as follows:

Set category drop-down list by default Select the first item (the string information in the drop-down box is stored in addinaccount.xml) spintype.setselection (0);

The use of spinner controls in Android development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.