Android Lollipop 视图高度不适合屏幕

Android Lollipop view height doesn't fit screen

我正在努力将面向 API 级别 18 的应用升级到至少支持 Lollipop 级别 21,但是我 运行 遇到了图形问题。当定位 API 级别 21+ 时,视图对于屏幕来说似乎太大了,应用程序的底部 运行 由屏幕按钮控制:

XML定义为:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <include
        layout="@layout/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

    <TabHost
        android:id="@android:id/tabhost"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <FrameLayout
                android:id="..."
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_above="@android:id/tabs" >

            </FrameLayout>

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true" >
            </TabWidget>
        </RelativeLayout>
    </TabHost>

</LinearLayout>

谁能看出我做错了什么?

在 v21 中试试这个 style.xml

<item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowTranslucentNavigation">true</item>
    <item name="android:fitsSystemWindows">true</item>

您可能还对this

感兴趣