2

我有一个包含 VideoViews 的 DialogFragment。问题是,一旦我开始向左/向右滑动,VideoView 就会在 ViewPager 的边界之外可见。我该如何消除这种情况。页面上的其余控件都可以,并且一旦我滑开页面就会隐藏,只有 VideoView 仍然可见。我正在 Android 4.2 上进行测试。

4

1 回答 1

0

在您的布局中,尝试在 VideoView 上方添加一个不可见的视图。这对我有用。

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <VideoView
        android:id="@+id/video_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <!-- This transparent view avoids the videoview to be visible out of its bounds -->
    <View
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#0000" />

</FrameLayout>
于 2015-03-06T10:39:12.343 回答