I have a spinner in my android app which contains 15 items and I want to set the default shown items in it (other items will be shown by scrolling ). how should I set it ?
Asked
Active
Viewed 27 times
1 Answers
1
Your Spinner is like
<Spinner
android:id="@+id/spnyear"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:gravity="center"
android:entries="@array/visit"
/>
and your items will be in Strings.xml
<string-array name="visit">
<item>Select Day</item>
<item>Today</item>
<item>Yesterday</item>
<item>All</item>
</string-array>
whichever you want to set as default put that item in the first, like i put as a
<item>Select Day</item>
it remains selected in Spinner