开发者

dynamically adding a value to a statically created spinner

I have a spinner that is c开发者_如何学JAVAreated using the resource file statically. now i want to dynamically add a value to the spinner. Is this possible?


Assuming your code looks something like step 4 in this Hello Spinner example (that is, you have a programmatic reference to your Spinner using the id from your XML layout and are using an ArrayAdapter as your data source), you should be able to call add() on your ArrayAdapter and then call notifyDataSetChanged() on it as well to have your Spinner update itself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜