How to display MediaController below the Navigation drawer

一世执手 提交于 2021-01-27 23:18:27

问题


I am having a display issue where the mediaController is floating on top of the navigation drawer (see image), when I click the navDrawer while the controller is visible.

I like to display the mediaController below the navDrawer instead.

according to the api, that should be the correct behavior

The way to use this class is to instantiate it programmatically. The MediaController will create a default set of controls and put them in a window floating above your application. Specifically, the controls will float above the view specified with setAnchorView().

I tried the suggestion to set the control using 'setAnchorView' on my videoView and it still displays the controller floating above the navigation drawer. Do note that videoView is displaying the video at the right level (below the navigation drawer).

    mediaController.setAnchorView(videoView);

Is there a way to force the mediaController to be below the navigation drawer?


回答1:


add
mMediaController.hide();
in overrided ActionBarDrawerToggle's method --> onDrawerSlide in initialization

mActionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout,"open", "close") {

        @Override
        public void onDrawerSlide(View mDrawerView, float slideOffset) {
            mMediaController.hide();
            super.onDrawerSlide(drawerView, slideOffset);
        }
    };

onDrawerSlide method fired when Navigation Drawer opened or closed by button or by your finger



来源:https://stackoverflow.com/questions/37916520/how-to-display-mediacontroller-below-the-navigation-drawer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!