2013-06-19 30 views
2

我有一個DialogFragment包含VideoViews。問題是,一旦我開始向左/向右滑動,VideoView在ViewPager的邊界外可見。我應該如何消除這一點。頁面上的其他控件可以正常使用,只要將頁面刷掉,只有VideoView保持可見狀態。 我正在測試Android 4.2。剪輯videoview範圍內的視圖

回答

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>