【发布时间】:2018-04-16 18:02:31
【问题描述】:
我正在为我的应用程序开发一个 UI,它在尺寸比为 18:9 的所有设备上都可以正常工作,除了小米 18:9 设备。它在标签布局和状态栏之间创建了不需要的空间,如下所示:
我没有为 Tab 布局添加任何上边距或内边距。
我的xml代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="0dp"
android:id="@+id/tabCardView">
<android.support.design.widget.TabLayout
android:layout_width="match_parent"
android:layout_height="@dimen/tabHeight"
android:id="@+id/tabLayout"
app:tabMode="fixed"
android:background="?attr/tabBackgroundColor"/>
</android.support.v7.widget.CardView>
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/viewPager"
android:background="?attr/homeBackgroundColor"
android:layout_below="@+id/tabCardView"/>
</RelativeLayout>
我不知道为什么会这样。
【问题讨论】:
-
尝试删除cardview