Change android:layout_gravity="start"
to either android:layout_gravity="end"
or android:layout_gravity="right"
(using end
will put the drawer on the left side of the screen for right-to-left configurations)
EDIT
It appears that the ActionBarDrawerToggle
is looking for a drawer on the same side as the action bar Home icon (Gravity.START
), which would be the left side for left-to-right layout directions. If you will always have the drawer on the right, you could do something like this:
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawer, R.drawable.ic_drawer, R.string.open_drawer, R.string.close_drawer) {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item != null && item.getItemId() == android.R.id.home) {
if (mDrawer.isDrawerOpen(Gravity.RIGHT)) {
mDrawer.closeDrawer(Gravity.RIGHT);
} else {
mDrawer.openDrawer(Gravity.RIGHT);
}
}
return false;
}
};
If the drawer will always be opposite the action bar Home icon, you could use Gravity.END
instead.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…