Populating spinner directly in the layout xml

前端 未结 3 1387
情深已故
情深已故 2020-11-30 17:24

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..

3条回答
  •  情深已故
    2020-11-30 18:02

    In regards to the first comment: If you do this you will get an error(in Android Studio). This is in regards to it being out of the Android namespace. If you don't know how to fix this error, check the example out below. Hope this helps!

    Example -Before :

    
        Small(0-4)
        Medium(4-8)
        Large(9+)
    
    

    Example - After:

    
        Small(0-4)
        Medium(4-8)
        Large(9+)
    
    

提交回复
热议问题