嘿所以我正在尝试创建一个具有不同选项的微调器,并且我不断为最后两行得到这两个错误。我正在关注http://developer.android.com/guide/topics/ui/controls/spinner.html#Populate,所以我不确定为什么会出现错误?
//Creating spinner for select/options
Spinner spinner = (Spinner) findViewById(R.id.typeFieldWardrobeScreen);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.type_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//for line above
Multiple markers at this line
- Syntax error on token "setDropDownViewResource", Identifier expected after this token
- Syntax error on token ".", ... expected
spinner.setAdapter(adapter);
//for line above
Multiple markers at this line
- Syntax error on token(s), misplaced construct(s)
- Syntax error on token "adapter", VariableDeclaratorId expected after
答案 0 :(得分:0)
我没有意识到我在onCreate方法之外有它,并且它不能在方法之外。