Action Bar menu icon without dropdown

2

I'm trying to remove the Action Bar's Overflow drop-down menu from Action Bar. In case it would be the one that has the 3 points, one on top of the other, by default and as default option, "Settings". I would like to remove this "Settings" item, by clicking on the menu icon, it already performs an action. Any ideas?

    
asked by anonymous 28.05.2015 / 16:17

1 answer

1

In the menu.xml you create the

<item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:icon="@android:drawable/ic_settings"
        app:showAsAction="always"
        android:title="settings" />

And then go to your Activity and

public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if(id == R.id.action_settings) {
                Intent intent = new Intent(this, SettingsActivity.class);
                startActivity(intent);
                return true;
        }
       return super.onOptionsItemSelected(item);
}

I implemented something like this in my app and it worked, I hope it works for you.

    
10.06.2015 / 21:38