Custom Dropdownlist with default value based on Spinner
DropdonwList (Spinner in Android term) looking in application very simple - we just click on useful DropDownList and DropdownList opened and allow us to see all possible value.
But programmatically this is complex idea combined from numbers of parts:
- Firstly, in activity where we use Spinner
- Each item define as text array in strings.xml and show as item_spinner.xml
- Now we take a look to Layout. In Layout we need to define default items and style. This Layout code. Default item have read from Layout.
- Additionally we need to define ane more attribute defaultSelection in Layout level to support successful compiling Layout.
- And last item of whole puzzle to create standard DropDownList in Android platform, as you can see, SpinnerOpen definition has additional styles SettingInput,that defined in separate style file.
- So, all we need more - just to add listener and handle selected item.
we use own custom class SpinnerOpen that adding additional functionality to standard AppCompatSpinner and show view to each items on arrayList.
AndroidMosaic context:
Comments (
)
)
Link to this page:
http://www.vb-net.com/AndroidMosaic/Index12.htm
|
|