0

This is problem occurred in toolbar navigation drawer that i could not be set in right side. if i set gravity the menu icon is not moving in right side. Please give me solution of this problem. Thank you

1 Answer 1

4

In your main layout set your ListView gravity to right:

android:layout_gravity="right" 

Also in your code:

mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
            R.drawable.ic_drawer, R.string.drawer_open,
            R.string.drawer_close) {

        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            if (item != null && item.getItemId() == android.R.id.home) {
                if (mDrawerLayout.isDrawerOpen(Gravity.RIGHT)) {
                    mDrawerLayout.closeDrawer(Gravity.RIGHT);
                } else {
                    mDrawerLayout.openDrawer(Gravity.RIGHT);
                }
            }
            return false;
        }
    };

Found here

To change icon to right:

<android.support.v7.widget.Toolbar
       xmlns:android="http://schemas.android.com/apk/res/android"
       android:id="@+id/toolbar"
       android:minHeight="?attr/actionBarSize"
       android:layout_height="?attr/actionBarSize"
       android:layout_width="match_parent">

       <ImageButton
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_gravity="end"
           android:onClick="backButton"
           android:background="@drawable/ic_launcher"/>

</android.support.v7.widget.Toolbar>

The important thing to do it's android:layout_gravity="end" you can put a ÌmageViewto button,LinearLayout`....

1
  • Thank you sir but the menu icon is on left side, it is not moving right side. please give solution for menu icon. Commented Oct 8, 2015 at 8:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.