【问题标题】:Kotlin app view overlaping with system navigation barKotlin 应用程序视图与系统导航栏重叠
【发布时间】:2022-12-11 17:20:06
【问题描述】:

使用安卓手机(三星),我的应用程序视图被系统导航栏覆盖。我希望视图在系统导航栏上方结束

问题截图

`

<?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="wrap_content">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <TextView
            android:id="@+id/tv_date"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="10dp"
            android:textColor="@color/gray"
            android:textSize="14sp" />

        <TextView
            android:id="@+id/tv_message"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/tv_date"
            android:layout_marginRight="20dp"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="25dp"
            android:textColor="@color/black"
            android:textSize="22sp"
            android:textStyle="bold" />


        <View
            android:id="@+id/v2"
            android:layout_width="100dp"
            android:layout_height="4dp"
            android:layout_below="@+id/tv_message"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="5dp"
            android:background="@drawable/border_main" />
        />


    </RelativeLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

`

尝试了一堆不同的 xml 选项,期望视图在系统导航栏之前结束。

【问题讨论】:

    标签: android kotlin


    【解决方案1】:

    我发现在我的活动中有下面的代码。

            window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
    

    删除它并且它工作正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多