What do you need to pass to v4.widget.DrawerLayout.isDrawerOpen()/.openDrawer()/.closeDrawer()

后端 未结 4 1233
死守一世寂寞
死守一世寂寞 2020-12-18 18:30

I\'ve been trying to move my code across to the DrawerLayout as suggested by android here as SlidingDrawer is deprecated.

My problem is tha

4条回答
  •  既然无缘
    2020-12-18 18:54

    In your Activity if you have a reference to the DrawerLayout and in this case the FrameLayout with the id R.id.menuPane you can also do...

    DrawerLayout mMenuPanel = (DrawerLayout) findViewById(R.id.mainmenuPanel);
    FrameLayout mMenuPane = (FrameLayout) findViewById(R.id.menuPane);
    mMenuPanel.isDrawerOpen(mMenuPane);
    

    Basically you have to pass in a reference to the view being used as the drawer within the DrawerLayout, which will always be mMenuPanel.getChildAt(1) anyways.

提交回复
热议问题