I need help figuring out what is wrong with my Snackbars (Design Support) that are not showing.
I have a VideoView (FrameLayout containing a dynamically created SurfaceView).
Layout File:
<?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>
I create and show a snackbar with this snippet:
... 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."); }
When I try to open a diner, it does not appear. However, when I remove the VideoView from my layout, it displays without any problems.
So, I think the VideoView is hiding it, or the diner is shown outside. To test this, I replaced VideoView with a basic view of the same size. But there I see snacks.
Has anyone else had a similar issue with SurfaceViews related to Snackbars?
source share