全屏表面视图隐藏了snackbar

Den*_*Loh 6 android surfaceview android-layout android-snackbar

我需要一些帮助来弄清楚我的Snackbars(设计支持)有什么问题,而这些问题并未出现.

我有一个VideoView(FrameLayout包含一个动态创建的SurfaceView).

布局文件是:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="false"
    android:id="@+id/coordinator"
    android:background="@android:color/white"
    tools:context="com.denisloh.typhoonCamera.MainActivity">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <VideoView
            android:id="@+id/videoView"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="top|start"
            android:background="@drawable/toolbar_gradient"
            android:theme="@style/AppTheme.AppBarOverlay"
            app:popupTheme="@style/AppTheme.PopupOverlay">

            <android.support.v7.widget.ActionMenuView
                android:id="@+id/action_bar"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content" />

        </android.support.v7.widget.Toolbar>

    </RelativeLayout>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center|end"
        android:layout_margin="@dimen/fab_margin"
        android:src="@drawable/ic_camera_white_24dp" />

</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

我用这个片段创建并显示小吃吧:

...
mCoordinatorLayout = (CoordinatorLayout) findViewById(R.id.coordinator);
...

private void showWifiSettingsSnackBar(final String message) {
    Snackbar.make(
            mCoordinatorLayout,
            getString(R.string.wifi_error_open_settings, message),
            Snackbar.LENGTH_INDEFINITE)
            .setAction(R.string.wifi_settings, new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
                }
            })
            .show();
    Log.d(TAG, "Showing snackbar.");
}
Run Code Online (Sandbox Code Playgroud)

当我尝试打开小吃店时,它没有显示.但是,当我从我的布局中删除VideoView时,它显示没有任何问题.

所以,我想,VideoView正在隐藏它或者快餐栏显示出界限.为了检查这一点,我用相同大小的基本视图替换了VideoView.但在那里,我可以看到小吃店.

其他人在使用与Snackbars相关的SurfaceViews时遇到了类似的问题吗?

小智 3

尝试添加videoView.setZOrderOnTop(false); 在你的java文件中。