Android : What use is MediaController's AnchorView?
Asked Answered
W

1

5

I would like my MediaController to hide only when the user touches only the bottom half part of the screen, because i have some buttons on the top part that need to be accessible with one click. That is, without the first click being intercepted by the MediaController.

From what i read on the developers doc :

...Specifically, the controls will float above the view specified with setAnchorView(). The window will disappear if left idle for three seconds and reappear when the user touches the anchor view.

My anchor_view layout :

<View android:id="@+id/player_control" 
    android:layout_width="wrap_content"
    android:layout_height="100dip"
    android:layout_alignParentBottom="true">
</View >    

Yet, when the Controller is on, whenever i touch the screen outside the anchor_view, it still only hides it, and doesn't fire the buttons events.

Is there a way to prevent that ?

Wapentake answered 30/9, 2011 at 14:8 Comment(1)
I'm having this problem as well. did you ever find the solution?Monosepalous
B
4

The anchor view is used by the MediaController only as a reference to get the position where it should start to draw the controllers. Controllers themselves are drawn in a new window floating over the window which all your views are attached to. When an instance of MediaController is created, this new floating window is built (using an internal API) and a touch listener is associated to its decor view, i.e. to its whole surface. This is why touching any part of the screen results in hiding the media controllers, and this is why I believe there is no easy way to customize this behavior: it may require you to extend or reimplement MediaController.

Bever answered 18/6, 2012 at 14:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.