The effect is as follows:
C # implementation Code
Using Android.app;
Using Android.os;
Using Android.widget; namespace Spinnerdemo {[Activity (Label = "@string/applicationname", Mainlauncher = true, Icon = "@drawable/icon")] Pu
Blic class Mainactivity:activity {private Spinner _cityspinner;
Private TextView _citynameview;
Private arrayadapter
Java Implementation Code
Package Com.example.halower.spinnerdemo;
Impor
Example 1Directly designated Android:entries, it is relatively simple, but the general selection box is enoughItems.xmlXML version= "1.0" encoding= "Utf-8"?>Resources> String-arrayname= "Ys"> Item>RedItem> Item>GreenItem> Item>YellowItem> String-array>Resources>View CodeActivity_main.xmlRelativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Android:layout_width= "Match_parent"Android:layout_height= "Match
The scenario exception information is as follows:android.view.windowmanager$badtokenexception:unable to add window-token [email protected] was not valid; Is your activity running?At Android.view.ViewRootImpl.setView (viewrootimpl.java:646)At Android.view.WindowManagerGlobal.addView (windowmanagerglobal.java:248)At Android.view.WindowManagerImpl.addView (windowmanagerimpl.java:69)At Android.widget.PopupWindow.invokePopup (popupwindow.java:993)At Android.widget.PopupWindow.showAsDropDown (popupwin
In the development of Android, often need to add address, here is a simple according to the XML file to parse to obtain the linkage of the provincial and municipal addressFirst in the Res directory to create a new folder XML, put the XML file in this folder, the format of XML, the detailed file in the download demoWrite a method to get the address in the XML filepublic void Getxmldata () {//Gets the resource in the XML file Xmlresourceparser parser = Getresources (). GETXML (r.xml.citys_weather)
Most of the time, we bind a value to the drop-down menu, but the spinner does not provide such a service.
So I searched for a long time on the Internet and finally found a simple and easy-to-use solution.
First, define an item class. Note the following:
The. tostring () function to override itBecause when the adapter displays data, if the object passed into the adapter is not a string, the object. tostring () is directly used ()
Public class citem
1. store data in array. xml
The content of array. XML is as follows:
2. InProgramTo call the spzone is my spinner control, and the layout of the drop-down list is the default layout of a drop-down list of Android. I set the string zone to null when "NONE" is displayed.
Spzone. setadapter (arrayadapter. createfromresource (this, R. array. newhouse_check_zone, android. r. layout. simple_spinner_dropdown_item); spzone. setonitemselectedlistener (N
: startactivity (); startactivityforresult ();//note Use scene, view Demo2 (iv) Exchange of data between activity:The first way:A page uses the Putextra () method of the intent object to pass the value, b page uses Getstringextra (), Getintextra () and other series method to receive the value one by one;The second way: "Common"A page uses the bundle object to save all the values that need to be passed through the intent Putextras () method, and the B page returns the bundle object using the Ge
First of all, this bug appears in your implements this listener, if it is an anonymous internal class implementation of the words can beSee the reason why the listener is invalid on the internet implementsAs if the thread, when listening, the thread
Spinner: Drop-down list, mainly used to display some options for users to choose, similar to the ComboBox inside the PC Application.The following conditions are required to use Spinner:1. A Spinner control2. data3. A AdapterFirst create a spinner
Let's see the final result first:
The content of our main. xml file is:
We created an arrays. xml file under the values directory.
The file content is:
rollen rollen Holt rollen Ren
All other files are default.
Android spinner's default style does not support line breaks and font style changes. Solution requirements: The system displays too much data and requires line breaks, while Android provides android. r. layout. simple_spinner_dropdown_item style
1. Prepare two images and prepare 9.png.
2. Define in drawableSpinner_selector.xml 3. Definition in style 4. Call 5. Define in LayoutSimple_spinner_item.xml 6. JavaCode Arrayadapter adapter = new arrayadapter (mcontext, R.
Original Url: http://www.cnblogs.com/tinyphp/p/3858920.htmlIn Web development, HTML provides a drop-down list implementation that uses the element to implement a drop-down list in which each Drop-down list item uses the Representation. This is an
Directory
4.6 left or right
Radiogroup and oncheckedchanged events
4.8 customize the drop-down menu Mode
Spinner and setdropdownviewresource
4.9 Add/delete a menu on the fly4.6 left or
Spinkit is a set of web animation effects, including 8 kinds of cool load animations based on CSS3 implementations. Create smooth, easily customizable animations with the powerful features of CSS3 Animation. Spinkit's goal is not to provide a solution that is compatible with every browser, but to provide a better technology implementation and a better use experience for modern browsers. (For best results, browse in modern browsers such as Chrome, Firefox, and Safari)
Loading Animation effect A
←jquery Easyui Form Plug-in –numberspinner value spinnerJQuery Easyui Form Plugin-Timespinner Time Spinner
JQuery Easyui Plugin
Extended from $.fn.spinner.defaults. Overrides the default defaults through $.fn.timespinner.defaults.The time Spinner (Timespinner) is created based on a spinner (spinner). It is
The spinner is equivalent to the drop-down list box in Html. In the following example, we will learn how to use the spinner.
Attribute:
Attribute name
Description
Android: prompt
This prompt is displayed in the drop-down list dialog box. (Translator's note: The title of the dialog box:
Method:Public CharSequence getPrompt ()Return ValuePrompt displayed when the dialog box is
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.