开发者

ArrayAdapter - Making a spinner?

http://developer.android.com/resources/tutorials/views/hello-spinner.html

I'm following this ^ tutorial on making a "spinner" but when I get to this code:

开发者_StackOverflow中文版
Spinner spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
            this, R.array.gender_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);

I get the "cannot be resolved to a type" error on:

ArrayAdapter

I'm not sure what to do here. I've done everything exactly how they said to, but I get these errors for some reason.


Are you not missing an import?

import android.widget.ArrayAdapter;

If you are developing in Eclipse, try a shortcut: Ctrl+Shift+O, which organizes your imports

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜