2015-04-06 60 views
1

我已將視頻視圖和圖像視圖和文本視圖放置在FrameLayout中我在全屏播放視頻時遇到問題。我只想使用框架或線性佈局。如何在框架佈局或線性佈局中創建視頻全屏幕視圖

<?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="fill_parent" > 

    <VideoView 
     android:id="@+id/vvhotsoptPass" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" /> 
</FrameLayout> 
+0

你可以發佈你的佈局文件與視頻視圖和圖像視圖和文本視圖在FrameLayout,如你所說你已經放置這些意見? – 2015-04-06 13:00:14

+0

使用此代碼requestWindowFeature(Window.FEATURE_NO_TITLE); \t \t getWindow()setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, \t \t \t \t WindowManager.LayoutParams.FLAG_FULLSCREEN)。在設置setContentView(R.layout.activity_main)之前;它將全面進入活動 – Hanuman 2015-04-07 04:56:24

回答

1

試試這個,它解決了我的問題。

DisplayMetrics metrics = new DisplayMetrics(); 
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics); 
android.widget.FrameLayout.LayoutParams params = (android.widget.FrameLayout.LayoutParams) videoView.getLayoutParams(); 
params.width = metrics.widthPixels; 
params.height = metrics.heightPixels; 
params.leftMargin = 0; 
videoView.setLayoutParams(params); 
相關問題