开发者

Android : What use is MediaController's AnchorView?

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 ?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜