如何设置全屏视频 [英] how to set video in full screen
本文介绍了如何设置全屏视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
海怎么设置视频全屏现在我附上我的屏幕截图....
<?XML版本=1.0编码=UTF-8&GT?;
<清单的xmlns:机器人=http://schemas.android.com/apk/res/android
包=videothumb.videothumb
安卓版code =1
机器人:=的versionName1.0>
<应用机器人:图标=@绘制/图标机器人:标签=@字符串/ APP_NAME>
<活动机器人:videothumbNAME =机器人:标签=@字符串/ APP_NAME>
&所述;意图滤光器>
<作用机器人:名字=android.intent.action.MAIN/>
<类机器人:名字=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>
< /活性GT; <活动机器人:名字=ViewVideo机器人:标签=@字符串/ APP_NAME
机器人:主题=@安卓风格/ Theme.Black.NoTitleBar.Fullscreen>
<意向滤光器><作用机器人:名字=android.intent.action.VIEW>< /作用>
<类机器人:名字=android.intent.category.DEFAULT>< /类别>
&所述; /意图滤光器>
< /活性GT; < /用途>
<采用-SDK安卓的minSdkVersion =8/>
<使用许可权的android:NAME =android.permission.MOUNT_UNMOUNT_FILESYSTEMS>
< /使用许可权>
< /清单>
ViewVideo.java
包videothumb.videothumb;
进口android.app.Activity;
进口android.content.Intent;
进口android.media.MediaPlayer;
进口android.os.Bundle;
进口android.view.SurfaceView;
进口android.view.View;
进口android.view.Window;
进口android.view.WindowManager;
进口android.view.View.OnClickListener;
进口android.widget.GridView;
进口android.widget.MediaController;
进口android.widget.VideoView;公共类ViewVideo延伸活动{
私人字符串的文件名;
私人VideoView视频;
@覆盖
公共无效的onCreate(捆绑savedInstanceState){
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow()。setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN); 的setContentView(R.layout.main1);
视频=(VideoView)findViewById(R.id.VideoView01);
System.gc()的;
意向I = getIntent();
捆绑额外= i.getExtras();
文件名= extras.getString(videofilename);
Video.setVideoPath(文件名);
Video.setMediaController(新的MediaController(本));
Video.requestFocus();
Video.start();
} }`
XML编码:
<?XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:方向=垂直
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT>
< VideoView
机器人:ID =@ + ID / VideoView01
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT>
< / VideoView>
< / LinearLayout中>
解决方案
你有没有尝试过这样的:
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
在你的类包含媒体播放器code。
和在XML - > layout_height =FILL_PARENT
和 layout_width =FILL_PARENT
我希望这会帮助你。
hai how set video in full screen now i am attach my screen shot....
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="videothumb.videothumb"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".videothumb" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="ViewVideo" android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
<intent-filter><action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS">
</uses-permission>
</manifest>
ViewVideo.java
package videothumb.videothumb;
import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.SurfaceView;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.GridView;
import android.widget.MediaController;
import android.widget.VideoView;
public class ViewVideo extends Activity {
private String filename;
private VideoView Video;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main1);
Video=(VideoView)findViewById(R.id.VideoView01);
System.gc();
Intent i = getIntent();
Bundle extras = i.getExtras();
filename = extras.getString("videofilename");
Video.setVideoPath(filename);
Video.setMediaController(new MediaController(this));
Video.requestFocus();
Video.start();
}
} `
xml coding:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<VideoView
android:id="@+id/VideoView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</VideoView>
</LinearLayout>
解决方案
Have you tried this:
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
in your class that contains mediaplayer code.
and in your xml--> layout_height="fill_parent"
and layout_width="fill_parent"
I hope this will help you.
这篇关于如何设置全屏视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文