我想将弹出微调器作为ActionBar中的一项。
现在,我的微调框看起来像一个下拉菜单,但我想使其像对话框一样显示。
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
MenuInflater mi=getMenuInflater();
mi.inflate(R.menu.main, menu);
mSpinnerItem1 = menu.findItem( R.id.menu_spinner1);
View view1 = mSpinnerItem1.getActionView();
if (view1 instanceof Spinner)
{
final Spinner spinner = (Spinner) view1;
spinner.setAdapter(ad1);
spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
}
return true;
}