我设法通过将抽屉放在每个onDrawerStateChanged()
和 onDrawerSlide()
前面来解决这个问题:
public class MainActivity extends ActionBarActivity
{
private DrawerLayout mDrawerLayout;
private View mDrawerView;
private ActionBarDrawerToggle mDrawerToggle;
@Override
protected void onCreate ( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
setContentView( R.layout.activity_main );
mDrawerLayout = ( DrawerLayout ) findViewById( R.id.drawer_layout );
mDrawerView = findViewById( R.id.left_drawer );
mDrawerToggle = new ActionBarDrawerToggle( this, mDrawerLayout, R.drawable.topbar_menu, R.string.drawer_open,
R.string.drawer_close )
{
@Override
public void onDrawerSlide ( View drawerView, float slideOffset )
{
bringDrawerToFront();
super.onDrawerSlide( drawerView, slideOffset );
}
@Override
public void onDrawerStateChanged ( int newState )
{
bringDrawerToFront();
super.onDrawerStateChanged( newState );
}
private void bringDrawerToFront()
{
mDrawerView.bringToFront();
mDrawerLayout.requestLayout();
}
};
mDrawerLayout.setDrawerListener( mDrawerToggle );
}
}
一个小缺点是变暗的背景仍在地图下方。