Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

(I am struggling with a simple problem I think!?

In my android app I made a spinner that will be filled with 2 values: On and Off. So I created a file called Arrays.xml in Resources/values/

Now I thought that I need something like this, but this doesn't work:

Spinner ActionSpinner = FindViewById<Spinner>(Resource.Id.ActionSpinner);
ActionSpinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs>(ActionSpinner_ItemSelected);
var ActionSpinnerAdapter = ArrayAdapter.CreateFromResource(this, Resource.Array.action_array, Android.Resource.Layout.SimpleSpinnerItem);
ActionSpinnerAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
ActionSpinner.Adapter = ActionSpinnerAdapter;

The spinner stays empty and I don't know what to do... Someone else asked this question too on this site, but this awnser doesn't seem to work for me. This was his awnser:

ArrayAdapter<String> adp1=new ArrayAdapter<String>(MainActivity.this,android.R.layout.simple_list_item_1, list);

Any suggestions?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
217 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...