How to move main content with Drawer Layout left side

前端 未结 6 440
有刺的猬
有刺的猬 2020-11-30 17:04

Just checked how to make menu with DrawerLayout here. But left side menu is moving on the front of main content. How can I set it to menu and main content move side by side(

6条回答
  •  情书的邮戳
    2020-11-30 17:51

    You might want to use this library of Drawer Toggles I wrote.

    I'm sure you will find ContentDisplaceDrawerToggle handy:

    ContentDisplaceDrawerToggle mContentDisplaceToggle = new ContentDisplaceDrawerToggle(this, mDrawerLayout, R.id.content_frame);    
    mDrawerLayout.setDrawerListener(mContentDisplaceToggle);
    

    ContentDisplaceDrawerToggle does exactly what you are saying. It moves the content view as you slide in/out the DrawerLayout.

    Example image

    If you want to combine different toggles you can use the ActionBarToggleWrapper or DrawerToggleWrapper

    Usage options are given in the read me file.

提交回复
热议问题