【发布时间】:2015-10-13 11:02:22
【问题描述】:
我正在使用 Android Studio 中的选项卡式活动模板制作一个选项卡式应用程序。客户想要底部的选项卡,它是在信息亭中使用的,所以我已经启用了沉浸式模式等。
我的草稿布局如下所示:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/AppTheme.AppBarOverlay"
android:layout_gravity="bottom">
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
AppBarLayout 位于底部,但其下方有一个用于隐藏导航栏的间隙:
有什么建议吗?
【问题讨论】:
-
怪异!尝试进入您的开发人员选项并显示布局边界以仔细检查它不是任何元素的边距/填充。一个 hacky 解决方案是在 TabLayout 中使用当前导航栏大小的 dp 设置负边距。
-
很好的建议,但是.... 对于布局边界,除了应用程序视图的最末端位于屏幕底部之外,没有显示任何边界。设置下边距实际上将 tabLayout 的底部隐藏在那个不可见区域的后面!!
标签: android android-navigation android-tablayout