Set drop down menu of Action bar invisible

I am using Android native action bar in my app. I created the drop down menu of action bar by:

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.actionbar_menu, menu);      
    return true;
}

For certain page, I would like to hide the action bar drop down menu. How to achieve this? Seems there is no direct method to set visibility to false for this drop down menu...

Answers


I managed to resolve this problem myself by set each menu item in drop down menu of action bar to be invisible:

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.actionbar_menu, menu); 

    menu.getItem(2).setVisible(false);
    menu.getItem(3).setVisible(false);     

    return true;
}

you should try to change the navigation mode of action bar when you create the activity...

actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);

Need Your Help

Performance recovering data of big MySQL table

mysql sql performance innodb

I have a large table in MySQL (InnoDB) and I having some performance issues.

Scatter Plot 3D for Web Application

3d scatter-plot

I am looking for a Scatter Plot 3D component for a Web application. Right now I am using JMathPlot (inside a Java Applet) to produce something like this: