Android全屏视频视图
我想像youtube一样全屏视频缩小和展开单击全屏视频单击全屏图像按钮我想全屏视频我使用片段 my videoplayer.xmlAndroid全屏视频视图,android,android-videoview,Android,Android Videoview,我想像youtube一样全屏视频缩小和展开单击全屏视频单击全屏图像按钮我想全屏视频我使用片段 my videoplayer.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/videolayout" android:layout_width="m
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/videolayout"
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:gravity="center_horizontal" >
<VideoView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center" />
</LinearLayout>
<ProgressBar
android:id="@+id/progressbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone" />
<FrameLayout
android:id="@+id/mediaController"
android:layout_width="fill_parent"
android:layout_height="80dp"
android:layout_alignParentBottom="true"
android:background="#80000000"
android:visibility="gone" >
<SeekBar
android:id="@+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginTop="5dp"
/>
<ImageButton
android:id="@+id/btnpalypause"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|bottom"
android:layout_marginBottom="8dp"
/>
<ImageButton
android:id="@+id/fullscreen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|bottom"
android:layout_marginBottom="5dp"
android:layout_marginLeft="7dp"
android:src="@drawable/maximize" />
</FrameLayout>
</RelativeLayout>
只要告诉我在全屏图像按钮点击事件我做什么 要在全屏上显示: 点击全尺寸按钮后,隐藏所有视频控制器视图 但您可以为您的tube player使用以下链接:
我希望它对您有用。我相信您是在询问沉浸式可视性 您可以通过如下设置可见性来完成此操作:
myView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE|View.SYSTEM_UI_FLAG_HIDE_NAVIGATION|View.SYSTEM_UI_FLAG_FULLSCREEN);
当用户触摸屏幕或强迫自己退出全屏沉浸式模式时,请确保将OnSystemMivibilityChangeListener设置为监视
这也仅适用于API 21及更高版本
要强制横向视图,请创建新活动并更新AndroidManifest.xml中的设置
<activity android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden" android:name="FullscreenVideoActivity" />
但yogendra我想使用自定义播放器,而不是youtube,只是告诉我如何在我的活动中实现全屏功能……或者全屏使用景观并隐藏其他视图,如控制器和所有。@yogendra我也试图隐藏控制器和其他视图,但我的视频在景观中仍然没有全屏显示是的,你明白我的意思了。。。。但是需要设置屏幕方向和横向?为此,我将使用另一个活动,仅使用视频视图,并强制它通过清单横向显示。
@Override public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
}