Display Snackbar below android.support.v7.widget.ToolbarSee original GitHub issue
Is there a way to display the TSnackbar under the android Toolbar? Your sample code contains a coordinator layout, but I use a different activity main layout:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v7.widget.Toolbar android:id="@+id/tool_bar" style="@style/AppTheme.CustomToolbar"/> <FrameLayout android:id="@+id/fragment_placeholder" android:layout_width="match_parent" android:layout_height="match_parent"/> </LinearLayout>
fragment_placeholder is obviously a layout where I add fragments.
The problem is that it doesn’t matter what view I provide to TSnackbar.make, the snackbar always appears over my Toolbar, but below the notification panel (where the battery and other stuff is displayed, as you describe in the README). I want to display the snackbar below the Toolbar so it overlays a bit of “fragment_placeholder”, but nothing from “tool_bar”. I hope this is possible.
- Created 7 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
I had the same issue, it was solved by simply wrapping my fragment layout in a coordinatorlayout. So, originally, my fragment layout top most view was a relative layout, I wrapped this in a coordinatorlayout and then attached the snackbar to the relativelayout, sorted. Good luck
I’ve updated the readme with the coordinatorlayout tip. Thanks for mentioning it