首页 > 解决方案 > Android - 向下滑动关闭活动时,Slidr 插件奇怪的边距

问题描述

我正在使用这个插件:

https://github.com/r0adkll/Slidr

当我向下滑动以关闭活动时,当我向下滑动时,活动上方有一个奇怪的边距:

在此处输入图像描述

内部活动:

val config = SlidrConfig.Builder()
    .position(SlidrPosition.TOP)
    .build();

Slidr.attach(this, config)

活动 xml:

<?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"
    android:background="@color/colorPrimary">

和风格:

<style name="slider" parent="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="listPreferredItemHeightSmall">56dp</item>
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
</style>

标签: javaandroidxmlkotlin

解决方案


添加<item name="android:fitsSystemWindows">true</item>到主题样式解决了这个问题


推荐阅读