android - Styling dropdown portion for Spinner widget -


i don't need fancy, bigger items in list (it's tiny) , different background. looks so:

enter image description here

declaration done this:

<spinner android:id="@+id/sp_servername" android:layout_width="fill_parent" android:layout_height="wrap_content" /> 

and use code bind items:

string[] items = new string[] { "chai latte", "green tea", "black tea" };         arrayadapter<string> adapter = new arrayadapter<string>(this, android.r.layout.simple_spinner_item, items);         spinnerservername.setadapter(adapter);         spinnerservername.setonitemselectedlistener(new onitemselectedlistener() {             @override             public void onitemselected(adapterview<?> parent, view view, int position, long id)             {                 log.v("item", (string) parent.getitematposition(position));             }              @override             public void onnothingselected(adapterview<?> parent)             {                 // todo auto-generated method stub             }         }); 

in place of android default layout give yours :

arrayadapter<string> adapter = new arrayadapter<string>(this, android.r.layout.simple_spinner_item, items); 

replace :

arrayadapter<string> adapter = new arrayadapter<string>(this, r.layout.custom_spinner_item, items); 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -