我正试图跟随一个视频来做微调器下拉菜单,但是在andriod.r、adapters、set dropdownviewresource和settex中出现了错误

wfveoks0  于 2021-07-09  发布在  Java
关注(0)|答案(0)|浏览(174)

语境;arrayadapter stateadapter=新的arrayadapter(mainactivity.this,andriod.r.layout.spinner,state);

StateAdapter.setDropDownViewResource(andriod.R.layout.spinner_dropdown_item);
    spinner.setAdapter(StateAdapter);
    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        public void OnItemSelected(AdopterView<?> parent, View view, int position, long id) {
            String yourState = spinner.getSelectedItem().toString();
            if (!yourState.equals("- Choose your state -")) {
                spinner.setText("You chose" + yourState);
            } else {
                txtState.setText("Choose a state");

            }
        }
        public void onNothingSeleced(AdopterView<?> parent) {
        }

    });

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题