我想在我的应用中使用上下文操作栏。当我启动动作模式时,默认操作栏和上下文操作栏之间有填充,如图2所示。如何避免这种填充?
用于开始动作模式
startSupportActionMode(modeCallBack);
回调方法:
private ActionMode.Callback modeCallBack = new ActionMode.Callback() {
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
MenuInflater inflater = mode.getMenuInflater();
inflater.inflate(R.menu.driver_main_menu, menu);
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false;
}
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
switch (item.getItemId()) {
case R.id.action_send:
Toast.makeText(getApplicationContext(), "Send!", Toast.LENGTH_SHORT).show();
mode.finish();
return true;
default:
return false;
}
}
@Override
public void onDestroyActionMode(ActionMode mode) {
}
};