Я делаю видеоплеер, если Ontouch на видео, он покажет панель действий (но над видео, как с использованием z-index в css), не меняет положение видеовидения (видео остается в центре, но панель действий есть).немного места для просмотра видео.
Это то, что я и что я получил (сравнение):
![enter image description here](https://i.stack.imgur.com/XtBX1.png)
Java-файл
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fullscreen2);
mVisible = true;
mControlsView = findViewById(R.id.fullscreen_content_controls);
mContentView = findViewById(R.id.fullscreen_content);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
mContentView.setOnTouchListener(tester);
//findViewById(R.id.dummy_button).setOnTouchListener(mDelayHideTouchListener);
String path = "android.resource://com.example.asus.exercise/" + R.raw.test;
Uri u = Uri.parse(path);
mContentView.setVideoURI(u);
mContentView.start();
}
XML-файлы
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FullscreenActivity2"
android:elevation="0dp">
<!-- The primary full-screen view. This can be replaced with whatever view
is needed to present your content, e.g. VideoView, SurfaceView,
TextureView, etc. -->
<VideoView
android:id="@+id/fullscreen_content"
android:layout_width="match_parent"
android:layout_height="723dp"
android:fitsSystemWindows="true"
android:gravity="center"
android:keepScreenOn="true"
android:elevation="@dimen/_10sdp"/>
<!-- This FrameLayout insets its children based on system windows using
android:fitsSystemWindows. -->
<!--<FrameLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:fitsSystemWindows="true">-->
<RelativeLayout
android:id="@+id/fullscreen_content_controls"
style="?metaButtonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:background="@color/black_overlay"
android:orientation="horizontal"
tools:ignore="UselessParent"
android:elevation="0dp">
</RelativeLayout>