【发布时间】:2017-12-08 16:47:52
【问题描述】:
我遇到了一个问题。我有一个自定义的工具栏布局,在我的活动 xml 中,我包含了这个工具栏。我的活动结构是:
- 顶部的工具栏布局使用
include标签。 - ViewPager
- TabLayout at bottom 以获取底部选项卡。
我面临的问题是,在某些设备上,它表现得很完美,但在一些设备中(在 moto G 系列设备上测试),底部标签留出了空间。
请参考以下图片:
在普通手机中显示预期的 UI
在 MOTO G 系列中
xml代码如下
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#efeded"
android:weightSum="11"
android:orientation="vertical">
<include layout="@layout/custom_tool_bar" />
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="10" />
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
style="@style/BottomTabLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#fff"
android:layout_weight="1"
app:tabIndicatorColor="@color/colorPrimaryDark"
app:tabSelectedTextColor="@color/colorPrimaryDark"
/>
</LinearLayout>
【问题讨论】:
标签: android android-layout android-tablayout android-tabs android-design-library