Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fix Mediacontroller position in Scrollview

I have a media controller in my android activity which uses setAnchorView to set the initial position. From what I have read if the media controller is in a scrollview the window of the media controller simply follows the scrolling which is obviously not what I want.

Is there some method to programatically fix the position of the media controller so it does not follow the scrollview?

Many thanks.

like image 962
David Avatar asked Dec 29 '14 10:12

David


1 Answers

You can hide media control on scroll event. It's not fix problem with view position but at least it's not visible.

scrollView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {

            @Override
            public void onScrollChanged() {
                mediaController.hide();
            }
        });
like image 123
Marcin Mierzejewski Avatar answered Oct 05 '22 16:10

Marcin Mierzejewski