【发布时间】:2014-06-17 18:31:44
【问题描述】:
我有一个操作栏..我只有一个徽标和一个图像按钮,当我按下按钮时,我想要一个带有三个值的微调器,每个都打开一个新活动,这是我的代码:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
android.app.ActionBar mActionBar = getActionBar();
mActionBar.setDisplayShowHomeEnabled(false);
mActionBar.setDisplayShowTitleEnabled(false);
LayoutInflater mInflater = LayoutInflater.from(this);
View mCustomView = mInflater.inflate(R.layout.custom_actionbar, null);
TextView mTitleTextView = (TextView) mCustomView.findViewById(R.id.title_text);
mTitleTextView.setText("My Own Title");
ImageButton imageButton = (ImageButton) mCustomView
.findViewById(R.id.imageButton);
imageButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
// i want the spinner to be add here
}
});
mActionBar.setCustomView(mCustomView);
mActionBar.setDisplayShowCustomEnabled(true);
}
@Override
public boolean onNavigationItemSelected(int arg0, long arg1) {
// TODO Auto-generated method stub
return false;
}
【问题讨论】:
标签: android android-actionbar spinner