android - AppCompat Snackbar not centered on tablet -


i'm trying show snackbar (via appcompat) display message user. works fine on phones, on tablets i'm getting

portrait

and

landscape

the code i'm using generate snackbar is

snackbar.make(mhomecontainer, r.string.rate_snackbar, snackbar.length_long)         .setaction("rate", ...)         .show(); 

any guidance on how make snackbar centered appreciated

<android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent">  <linearlayout     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical">      <view         android:id="@+id/status_bar"         android:layout_width="match_parent"         android:layout_height="0dp"         android:background="@color/main"         android:elevation="8dp"/>      <include layout="@layout/toolbar" />      <relativelayout         android:id="@+id/home_container"         android:layout_width="match_parent"         android:layout_height="match_parent">          <framelayout             android:id="@+id/main_content"             android:layout_width="match_parent"             android:layout_height="match_parent"             android:layout_alignparentbottom="true" />          <listview             android:id="@+id/home_search_list"             android:visibility="gone"             android:layout_width="match_parent"             android:layout_height="match_parent"             android:background="#88000000"/>      </relativelayout> </linearlayout>  <include layout="@layout/navigation_list" />  </android.support.v4.widget.drawerlayout> 

you need use coordinatorlayout in order make happen. here article describes how that. additionally need provide layout files want use non-tablets vs. tablets can retain full-width phones. layout component need use if use combination of fab, app bar , snackbar.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -