开发者

Change a Spinner programmatically in Android

Im trying to add a Spinner in my app configuration Activity. The spinner offers an option and save 开发者_JS百科it persistently with SharedPreferences.

How can I set the spinner in a position programmatically (for init in the activity creation) Thanks in advance


To programatically set the spinner position you should use the method:

setSelection(position_to_select)

From the Spinner class (Actually the method's implementation is from the android.widget.AbsSpinner but it is inherited by Spinner class.

You can check the API documentation for it here: http://developer.android.com/reference/android/widget/Spinner.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜