【发布时间】:2015-09-05 12:23:01
【问题描述】:
我正在尝试显示一个快餐栏(通过 appcompat)来向用户显示一条消息。它在手机上运行良好,但在平板电脑上我得到了
和
我用来生成快餐栏的代码是
Snackbar.make(mHomeContainer, R.string.rate_snackbar, Snackbar.LENGTH_LONG)
.setAction("Rate", ...)
.show();
任何关于如何使这个小吃店居中的指导将不胜感激
<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>
【问题讨论】:
-
根据this,Snacker 在平板电脑/桌面上不应该是全宽的。
-
谢谢,我已经将它更新为居中而不是全宽
-
什么是
mHomeContainer?mHomeContainer会填满屏幕的整个宽度吗? -
它是一个全宽的RelativeLayout
-
发布您的平板电脑布局
标签: android material-design android-appcompat