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
Asked
Active
Viewed 3,328 times
1 Answers
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;
}
};
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`....
-
Thank you sir but the menu icon is on left side, it is not moving right side. please give solution for menu icon. – Nazima Kauser MMF Oct 08 '15 at 08:50