Simple Spinner in Android

Daniyar Nurgaliyev
1 min readJan 5, 2019

--

  1. Add Spinner in activity_main.xml:
<Spinner
android:id="@+id/spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

2. Add string-array labels in strings.xml:

<string-array name="labels_array">
<item>Home1</item>
<item>Home2</item>
<item>Home3</item>
<item>Home4</item>
</string-array>

3. Add this code to MainActivity.java file:

--

--

No responses yet