0

I have an overflow menu on my Toolbar, which I'm using to navigate between my activities.

<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" tools:context=".HomePage">

<item
    android:id="@+id/homeActionBar"
    android:title="Home"
    android:orderInCategory="100"
    app:showAsAction="never" />

<item
    android:id="@+id/allergiesActionBar"
    android:title="Allergies"
    android:orderInCategory="100"
    app:showAsAction="never" />

<item
    android:id="@+id/calendarActionBar"
    android:title="Calendar"
    android:orderInCategory="100"
    app:showAsAction="never" />

<item
    android:id="@+id/contactsActionBar"
    android:title="Contacts"
    android:orderInCategory="100"
    app:showAsAction="never" />

The overflow button with all of these options appears on the right hand side of my Toolbar. Does anybody know how to place it all the way to the left?

This is a related but secondary question. I don't have any fragments. They're all activities. I want to navigate between them on my toolbar. What's the best solution for this? Again, I created the overflow menu, which seems to be working fine. Is that typically the best route? I'm avoiding a navigation drawer due to my lack of fragments.

Thank you.

Mark F
  • 1,523
  • 3
  • 23
  • 41

1 Answers1

0

If you really want have an Overflow Menu on the left, you would need to create your own custom toolbar in xml than replace existing with your own version using a code like in this example:

here is what works for me like a dream: in the Activity I have this:

//hiding default app icon
ActionBar actionBar = getActionBar();
actionBar.setDisplayShowHomeEnabled(false);
//displaying custom ActionBar
View mActionBarView = getLayoutInflater().inflate(R.layout.my_action_bar, null);
actionBar.setCustomView(mActionBarView);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM) my_action_bar.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/turquoise">

    <ImageButton 
        android:id="@+id/btn_slide"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:background="@null"
        android:scaleType="centerInside"
        android:src="@drawable/btn_slide"
        android:paddingRight="50dp"
        android:onClick="toggleMenu"
        android:paddingTop="4dp"/>
</RelativeLayout>

From Positioning menu items to the left of the ActionBar in Honeycomb

Note, that in Android apps on the left used to be a Navigation Drawer menu. If you would like to have it instead of Overflow Menu, please check this: Android Actionbar Left Menu

Hope it help

Community
  • 1
  • 1
piotrek1543
  • 19,130
  • 7
  • 81
  • 94