Android Learning Note Six--spinner

Source: Internet
Author: User

Spinner

==>

Spinner is an indirect subclass of ViewGroup and therefore can also be used as a container.

Common Properties:

android:prompt--Set the list box selection box's prompt information

  android:entries--sets the list item for the drop-down list box for the array resource

Note: When using spinner, if you can pre-instruct the contents of the ListBox, you do not need to write code, just specify the Android:entries property for spinner to implement a drop-down list box.

Example one: The simplest way to use

<?xml version= "1.0" encoding= "Utf-8"?><resources> < String-array name= "Books" > <item> big Talk design mode </item> <item> Big android</item> < Item>java Advanced Programming </item> </string-array></resources><relativelayout xmlns:android= "/http Schemas.android.com/apk/res/android "xmlns:tools=" Http://schemas.android.com/tools "android:layout_width=" Match_ Parent "android:layout_height=" match_parent "android:paddingbottom=" @dimen/activity_vertical_margin "Android:padd ingleft= "@dimen/activity_horizontal_margin" android:paddingright= "@dimen/activity_horizontal_margin" Android: paddingtop= "@dimen/activity_vertical_margin" tools:context= ". Indexactivity "> <spinner android:id=" @+id/spcontent "android:entries=" @array/books "Android : layout_width= "match_parent" android:layout_height= "wrap_content"/></RELATIVELAYOUT> 

Note: You need to add the Arrays.xml file to the values folder, such as:

Note: You can add spinner Select events by handling Setonitemselectedlistener ...

Example Two

Android Learning Note Six--spinner

Related Article

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.