开发者

Options menu in an Android application

I want to open up the options menu by clicking on开发者_JAVA技巧 my own created button; is this possible?


If you don't want to use the button of the phone, you have to do the following :

define a listener on your button:

openMenuButton = (Button) findViewById(R.id.yourButton);
    openMenuButton .setOnClickListener(this);

and then in the method onClick(), add :

openOptionsMenu()


Use the openOptionsMenu() method of your Activity to open the Menu programatically.

Still, what Nikola said is right - you'd be better conforming with Android's guidelines.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜