Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spinner - how to set border around drop down list?

I have this spinner and want to know how I can put border around this

    Spinner dropdown = (Spinner)findViewById(R.id.spinnerUpdateContactMethod);
    String[] items = new String[]{"1", "2", "three"};
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, items);
    dropdown.setPrompt("Please select ");
    dropdown.setAdapter(adapter);

the prompt doesn't actually come up on the screen. Please could someone help me with this.

like image 457
dark_illusion_909099 Avatar asked Apr 01 '15 09:04

dark_illusion_909099


1 Answers

for custom border you can create an xml file inside drawable folder

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="@color/white_overlay_8x" />
    <corners android:radius="6dip" />
    <stroke
        android:color="@color/white"
        android:width="@dimen/dot" />

</shape>

and set

android:background=@drawable/file;

in your spinner(xml file of activity)

like image 124
Karthika PB Avatar answered Nov 10 '22 00:11

Karthika PB