Я разрабатываю приложение, которое будет показывать 2 видео одновременно. Один маленький в правом нижнем углу, а другой полный экран (вроде).
Когда я запускаю video_view на устройстве Android 6.0.1, порядок работает правильно. Но когда я запускаю его на более новой версии (например, Android 7), он не упорядочивается правильно. Также функция setZ () ничего не делает для меня.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<nl.hacker115.drivingwithdrivepro550.CustomVideoView
android:id="@+id/roadCamera"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<nl.hacker115.drivingwithdrivepro550.CustomVideoView
android:id="@+id/faceCamera"
android:layout_width="500dp"
android:layout_height="300dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:layout_gravity="bottom|end" />
</FrameLayout>
Я хочу, чтобы faceCamera был на вершине roadCamera, как я могу это сделать?
Мой CustomVideoView.java выглядит так
package nl.hacker115.drivingwithdrivepro550;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.VideoView;
public class CustomVideoView extends VideoView {
private PlayPauseListener mListener;
public CustomVideoView(Context context) {
super(context);
}
public CustomVideoView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomVideoView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public void setPlayPauseListener(PlayPauseListener listener) {
mListener = listener;
}
@Override
public void pause() {
super.pause();
if (mListener != null) {
mListener.onPause();
}
}
@Override
public void start() {
super.start();
if (mListener != null) {
mListener.onPlay();
}
}
public static interface PlayPauseListener {
void onPlay();
void onPause();
}
}