I'd like to display a Snackbar in my Activity. It works fine on my phone (Oneplus One CM13), however for some reason on the tablet (Nexus 7 2013 LineageOS 14.1 android 7.1.1) the action Button
is displayed right after the Snackbar's text TextView
(with some padding and margins).
After turning Show layout bounds
on, I've noticed that on the phone the TextView
takes up the whole remaining space (which makes sense), and on the tablet it just wraps it's content with about 16dp of margin on the right.
I've tried to change the Gravity
of the action Button
using the LayoutParams
but it didn't work. I didn't modify the Snackbar in any way (except when trying to fix the problem). The Activity is a freshly created Empty Activity using Android Studio 2.3.
EDIT: Here's the full XML layout (fully generated by Android Studio):
<?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:id="@+id/coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.roundel.csgodashboard.ui.activity.SnackbarTestActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email"/>
</android.support.design.widget.CoordinatorLayout>