我想说明onCreateOptionsMenu这是对应用程序的右上角侧。而不触及三个点。什么我其实刨做的是,当应用程序的第一次,我想自动显示菜单项,用户运行,我怎么能做到这一点see the screenshot to get more details如何触发onCreateOptionsMenu自动
SharedPreferences preferences= PreferenceManager.getDefaultSharedPreferences(this);
if (!preferences.getBoolean("Time",false))
{
// code to trigger onCreateOptionsMenu
Toast.makeText(getApplicationContext(), "Showing menu items ", Toast.LENGTH_LONG).show();
SharedPreferences.Editor editor=preferences.edit();
editor.putBoolean("Time",true);
editor.commit();
}
如果您正在寻找的东西,你想在代码中的待办事项,这是很好的搜索_How到... programmatically_这将产生 - 旁多堆栈溢出的答案 - 这答案有很多情况下F.E.对于程序兼容性/工具栏和onCreate'的'烦恼:http://stackoverflow.com/questions/3133318/how-to-open-the-options-menu-programmatically和另一件事,如果你想呼吁的行动UI(用户界面上的螺纹)编程它可能是好签http://stackoverflow.com/questions/12850143/android-basics-running-code-in-the-ui-thread – makadev