Android How to move menu to the left on small screens

138 views Asked by At

When i added additional item to menu, it go off the screen on phone with smaller screen like 400x800. I tried to add padding but i don't want to make icon smaller but only move whole menu a little bit to the left because i see there is space for that. Does anyone has similar problem and resolve it ? enter image description here

code:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <item
        android:id="@+id/graphic"
        android:icon="@drawable/ic_graphic_white_30dp"
        android:title="Graphic"
        app:showAsAction="always" />

    <item
        android:id="@+id/save"
        android:icon="@drawable/ic_save_white_24dp"
        android:title="@string/save"
        app:showAsAction="always" />

    <item
        android:id="@+id/share"
        android:icon="@drawable/ic_share_white_24dp"
        android:title="@string/share"
        app:showAsAction="always" />

    <item
        android:id="@+id/count"
        android:icon="@drawable/ic_pie_chart_white_24dp"
        android:title="@string/count"
        app:showAsAction="always" />
    
    <item
        android:id="@+id/camera"
        android:icon="@drawable/ic_camera_alt_white_24dp"
        android:title="@string/photo"
        app:showAsAction="always" />

    <item
        android:id="@+id/lock"
        android:icon="@drawable/ic_action_secure"
        android:title="@string/lock"
        app:showAsAction="always" />
</menu>
1

There are 1 answers

2
Jaimin Modi On

You can use configrations of your actionBar as below:

ActionBar mActionBar = getSupportActionBar();
mActionBar.setNavigationMode(NAVIGATION_MODE_LIST);
mActionBar.setListNavigationCallbacks(mAdapter, mNavigationCallback);

You can follow this example : Sample Here