本文介绍了onPrepareOptionsMenu有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为Android制作Option Menu,我已经访问了此站点.在他们的脚本中,我找到了onPrepareOptionsMenu,我尝试使用带或不带onPrepareOptionsMenu的Android 2.3.3编译器进行编译和运行,两者都可以,但是我看不出有什么区别.

I want to make Option Menu for Android, I have visit this site. In their script, I found onPrepareOptionsMenu, I try to compile and run using Android 2.3.3 compiler with and without onPrepareOptionsMenu, both works, but I didn't see any difference.

public boolean onCreateOptionsMenu(Menu menu){
//code here
}

public boolean onOptionsItemSelected(MenuItem item){
//code here
}

public boolean onPrepareOptionsMenu(Menu menu){
//code here
}

onPrepareOptionsMenu方法实际上是做什么的?那方法重要吗?我可以删除该方法吗?

What is actually onPrepareOptionsMenu method do? Is that method important? Could I just delete the method?

添加

哦,我也听说过Android 3.0中的Action Bar,它说操作栏是制作Option Menu的替代方法,并且它使用onPrepareOptionsMenu.是吗?

Oh, I also hear about Action Bar in Android 3.0, it says that Action Bar is the alternative way for make Option Menu, and it using onPrepareOptionsMenu. Is that right?

谢谢...

推荐答案

API :

这篇关于onPrepareOptionsMenu有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 02:32