巨大的下巴出现在应用程序的顶部window

Huge chin appears on top of the application window

我正在编辑 Sipdroid 并对 UI 进行更改,但是此应用程序中的每个 activity 顶部都有一个巨大的下巴,我似乎无法隐藏反正。看起来它被识别为状态栏,正如您从我在下面共享的代码中看到的那样,而且每当我更改状态栏颜色时,下巴也会变成该颜色。截至目前,我发现它不在屏幕顶部创建填充的唯一方法是将 <item name="android:windowTranslucentStatus">true</item> 添加到样式 XML.
以下是布局 XML 文件和 Kotlin class 的代码:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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">

    <TextView
        android:id="@+id/hello"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="Hello World"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
package org.sipdroid.sipua.ui

import android.app.Activity
import android.graphics.Rect
import android.os.Bundle
import android.view.View
import android.view.Window
import android.widget.TextView
import android.widget.Toast
import org.sipdroid.sipua.R

class TestActivity : Activity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_test)

        val btn = findViewById<TextView>(R.id.hello)
        btn.setOnClickListener {
            // gets the status bar height
            val rectangle = Rect()
            window.decorView.getWindowVisibleDisplayFrame(rectangle)
            val statusBarHeight = rectangle.top
            val contentViewTop = window.findViewById<View>(Window.ID_ANDROID_CONTENT).top
            val titleBarHeight = contentViewTop - statusBarHeight

            // makes the TextView as high as the status bar,
            // so we have a visual representation of the
            // actual height with layout bounds visible
            btn.height = statusBarHeight

            Toast.makeText(
                this@TestActivity,
                "$statusBarHeight $titleBarHeight ${rectangle.height()}",
                Toast.LENGTH_SHORT
            ).show()
        }
    }
}

These 是显示有和没有布局边界的屏幕截图。

好的,所以我解决了这个乱七八糟的问题,结果我唯一需要做的就是从清单中删除以下代码:

<supports-screens
    android:anyDensity="false"
    android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true" />

在setContentView()之前的onCreate方法中添加getActionBar().hide()