Skip to main content

Posts

Showing posts with the label simple spinner in android

Spinner in Android/Spinner Example/Simple Spinner Program

Spinner in Android/Spinner Example/Simple Spinner Program Spinner is a widget similar to a drop-down list for selecting items .  Create an array of items to be  displayed String androidphones []={ "Sony Ericson Xperia" , "Motorola Droid" , "Samsung Galaxy" , "HTC Sensation" , "LG Nitro" , "Google Nexus" }; Add an array adapter to display the spinner spinner .setAdapter( new ArrayAdapter<String>( this , android.R.layout. simple_spinner_item , androidphones )); In spite of android.R.layout. simple_spinner_item , you can also add android.R.layout.simple_spinner_dropdown_item                           or android.R.layout.simple_dropdown_item_1line Source code main.xml <? xml version = "1.0" encoding = "utf-8" ?> < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"     android:orientation = ...