首页 > 解决方案 > SlidingUpPanelLayout 可见性问题

问题描述

SlidingUpPanelLayout 有问题。我的观点是这样构建的:

 <com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto"
        android:id="@+id/list_sliding_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="top"
        sothree:umanoDragView="@+id/dragView"
        sothree:umanoOverlay="true"
        sothree:umanoPanelHeight="@dimen/filtering_list_closed_height"
        sothree:umanoShadowHeight="@dimen/app_bar_elevation">

        <androidx.coordinatorlayout.widget.CoordinatorLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            // some views

        </androidx.coordinatorlayout.widget.CoordinatorLayout>

        <FrameLayout
            android:id="@+id/list_filtering_fragment_container"
            android:name="com.example.test.scenes.list.filtering.FilteringFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </com.sothree.slidinguppanel.SlidingUpPanelLayout>

它一直在工作,直到我添加了必须将list_filtering_fragment_container可见性设置为的新功能GONE。当我切换可见性状态时一切正常,但当我移动到另一个片段并返回到前一个片段时它不起作用。

编辑

看起来像:

设置可见性后我想要达到的正常状态VISIBLE

前

设置可见性后的状态VISIBLE(更改片段后)

在此处输入图像描述

我还可以在布局检查器中看到,两种情况下,屏幕上的位置和该元素的高度都不同。我尝试使用slidingUpPanel.setPanelState(PanelState.HIDDEN),但由于某种原因它在 100% 的情况下不起作用。看起来视图超出了屏幕并且没有回到正确的位置。问题是为什么它会这样?

标签: androidslidingpanelayout

解决方案


推荐阅读