在我的Galaxy Tab 10.1上的日历应用程序中,创建新事件时,标题栏/操作栏区域中会出现一个对话框,其中包含完成和取消按钮.

我想在我的应用中实现这一点.我已经尝试使用setHasOptionsMenu(true)除了覆盖onCreateOptionsMenu我的DialogFragment子类,但我的动作项目没有出现.我也试过getDialog().getActionBar()从内部打电话,onCreateView但总是回来null.
如果我开始一个Activity而不是显示一个对话但是占据了整个屏幕,我能够正常工作.是否有标准的方法来使用DialogFragment?
我想以对话框打开活动
public class MoveActivity extends Activity {
private ListView list;
private DocAdapter adapter;
private ArrayList<Dictionary<String, String>> mlist;
DatabaseHelper helper;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_move);
list = (ListView) findViewById(R.id.list);
helper = ApplicationClass.getDatabaseHelperInstance();
helper.open(DatabaseHelper.readMode);
mlist = helper.getDocList();
helper.close();
adapter = new DocAdapter(this, mlist);
list.setAdapter(adapter);
}
}
Run Code Online (Sandbox Code Playgroud)