更改菜单选项动态根据条件。 [英] Change menu option dynamically according to condition.

查看:133
本文介绍了更改菜单选项动态根据条件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让菜单布局和功能的改变,如果在另一个 Java类
我还挺新本,所以我只了解不同的屏幕和一些code,但数量不多。

How do I let the menu layoutand function change if on another java class? I am kinda new to this so i only know about the different screens and some code, but not much..

所以我想在菜单布局来改变我的吩咐后。

So i would like the menu layout to change after I commanded that.

例如:布局是全屏,选项和退出。当我点击全屏,我想要的菜单更改,以便它现在的样子:退出全屏,选项,退出

For example: layout is Fullscreen, options and quit. When I click on fullscreen, I want the menu to change so that it now looks like: Exit Fullscreen, options, quit.

在此先感谢!

推荐答案

您可以保留一些布尔或任何你想要的其他变量的状态。
然后在<一检查这些href=\"http://developer.android.com/reference/android/app/Fragment.html#on$p$ppareOptionsMenu%28android.view.Menu%29\"相对=nofollow>在prepareOptionsMenu 和膨胀正确的菜单。

You can keep your state with some booleans or any other variables you want. Then check these in onPrepareOptionsMenu and inflate the correct menu.

这篇关于更改菜单选项动态根据条件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆