Is it possible to populate the options of a Spinner right in the layout xml? This page suggests I should use an ArrayAdapter? It seems awkward not being able to do it..
+2
A:
Im not sure about this, but give it a shot.
In your strings.xml define:
<string-array name="array_name">
<item>Array Item One</item>
<item>Array Item Two</item>
<item>Array Item Three</item>
</string-array>
In your layout:
<Spinner
android:id="@+id/spinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"
android:entries="@array/array_name"
/>
I've heard this sometimes doesnt work on the designer, but compiles fine.
blindstuff
2010-10-27 02:47:15
that is excellent, thanks a lot!
cambraca
2010-10-27 03:00:14