-2

I have to implement the following functionality. See the picture.

enter image description here

Can I change the functionality of Navigation drawer? I haven't any found fix for my problem.

I hope you can help me, thanks in advance.

1 Answers1

2

Yes it's possible. However I advise you against it because it kind of breaks the UI.

If you choose to do it though, first you need to be able to access the overflow menu (circled button). This was answered before here, so I'll just provide a style.xml snippet:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:actionOverflowButtonStyle">@style/Overflow</item>
</style>

<style name="Overflow" parent="Widget.AppCompat.ActionBar">
    <item name="android:contentDescription">OVERFLOW</item>
</style>

Then, when the home (navigation drawer) button is clicked you open the overflow menu:

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        final View decor = getWindow().getDecorView();
        ArrayList<View> results = new ArrayList<>();
        decor.findViewsWithText(results, "OVERFLOW",
                View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION);

        if (results.size() == 1) {
            results.get(0).performClick();
            return true;
        }
    }

    return super.onOptionsItemSelected(item);
}
Community
  • 1
  • 1
Simas
  • 43,548
  • 10
  • 88
  • 116
  • You're absolutely right, I hate to break the UI but sometimes people get bighead. Thank you very much. It has been very helpful. – Marcos Navarro Feb 23 '15 at 09:42