微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – 全屏视频播放器 – 导航栏后面的mediacontroller

我有一个隐藏在导航栏(ICS上的软导航键)后面的mediacontroller的问题.首先是OK(第一张图片),但是当第一次隐藏导航栏时,Mediacontroller会调整大小以适应屏幕(正确),但是当导航栏再次出现时(第二张照片)不会调整大小.此外,广告被移动(隐藏屏幕截图).

如果我理解文档正确,系统Windows应负责调整大小.但它不工作

我怎样才能做到这一点?感谢任何帮助.

我在galaxy Nexus上进行测试.

XML布局:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/playerLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:animateLayoutChanges="true"
android:background="@color/black" >
<mynamespace.BKDVideoView
    android:id="@+id/videoview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"/>
<mynamespace.SubtitleTextView
    android:id="@+id/subtitleText"
    style="@style/SubtitleOverlayText"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|center_horizontal"
    android:layout_marginBottom="30dp"
    android:gravity="center"
    android:visibility="gone"
    android:fitsSystemWindows="true"
    android:animateLayoutChanges="true"/>
<FrameLayout
    android:id="@+id/adLayout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="top|right"
    android:fitsSystemWindows="true"
    android:animateLayoutChanges="true"/>
<FrameLayout
    android:id="@+id/videoMediaControllerHolder"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:animateLayoutChanges="true"/>

BKDVideoView是通过一些自定义功能从VideoView的GrepCode复制的.我对MediaController做了同样的事情.
在MediaController中,我打电话叫:

int newVis = SYstem_UI_FLAG_LAYOUT_FULLSCREEN | SYstem_UI_FLAG_LAYOUT_HIDE_NAVIGATION | SYstem_UI_FLAG_LAYOUT_STABLE;
    if (!visible)
    {
        newVis |= SYstem_UI_FLAG_LOW_PROFILE | SYstem_UI_FLAG_FULLSCREEN | SYstem_UI_FLAG_HIDE_NAVIGATION;
    }

    // msystemUIHolder -> FrameLayout (playerLayout)
    msystemUIHolder.setsystemUIVisibility(newVis);

更新:如果您有同样的问题,请在可接受的答案中查看评论.对于需要全屏使用sammyboy代码的视图.感谢两者.对不起,我需要太多的时间来弄清楚,不能给你点:(

解决方法

这是系统栏问题.一些设备fill_parent或match_parent实体具有完整的屏幕尺寸,不能识别系统栏的宽度和高度.
我建议:以编程方式给出一个整数值的视图. (计算系统栏宽和高度).并从屏幕尺寸中移除sb的宽度或高度(横向或纵向模式)
并将此值设置为视图.

here的答案如何获取屏幕尺寸等

原文地址:https://www.jb51.cc/android/313664.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐