安卓:什么用的MediaController的AnchorView? [英] Android : What use is MediaController's AnchorView?

查看:1513
本文介绍了安卓:什么用的MediaController的AnchorView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的MediaController隐藏只有当用户触摸只有屏幕的下半部分的部分,因为我已经在顶部需要可访问与点击一些按钮。
也就是说,如果没有第一次点击正在由截获的MediaController

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 :

...具体地说,控制
  将浮()与setAnchorView指定的视图上方。窗户
  会消失,如果闲置三秒钟,重新出现时,
  用户触摸了锚视图。

...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.

我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 >    

然而,当控制器是,每当我触摸屏的anchor_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.

有没有办法来prevent呢?

Is there a way to prevent that ?

推荐答案

锚视图用于由的MediaController 只能作为参考,以获得位置应启动绘制控制器。控制器本身在新绘制的窗口的漂浮在所有的意见都贴在车窗。当创建的MediaController 的一个实例,这种新的浮动窗口建立(使用内部API)和触听众被关联到其装饰视图,即它的整个表面上。这就是为什么在隐藏的媒体控制器,触摸屏幕效果的任何部分,这就是为什么我相信没有简单的方法来定制这一行为:它可能需要延长或重新实现的MediaController

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.

这篇关于安卓:什么用的MediaController的AnchorView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆