如何在SlidingUpPanel中禁用扩展状态?

时间:2019-03-27 14:20:54

标签: android kotlin

我在Android应用程序中使用SlidingUpPanel。我在面板上设置了anchorPoint,但在将锚点状态更改为展开状态后仍会滑动,因此如何禁用展开状态? Here's a video where i illustrated problem

        // Init views
        slidingPanelLayout = findViewById<SlidingUpPanelLayout>(R.id.sliding_panel)
        landmarkIv = findViewById<ImageView>(R.id.landmark_iv)

        // When app starts we don't need to see sliding panel
        slidingPanelLayout.panelState = PanelState.HIDDEN
        slidingPanelLayout.anchorPoint = 0.75f

        landmarkIv.setOnClickListener {
            // When we click the image we must see sliding panel
            if (slidingPanelLayout.panelState == PanelState.HIDDEN) {
                slidingPanelLayout.panelState = PanelState.COLLAPSED
            } else {
                // Otherwise we hide the sliding panel
                slidingPanelLayout.panelState = PanelState.HIDDEN
            }
        }
    <com.sothree.slidinguppanel.SlidingUpPanelLayout
            android:id="@+id/sliding_panel"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="bottom"
            app:umanoPanelHeight="68dp"
            app:umanoShadowHeight="1dp"
            app:umanoDragView="@id/dragview"
            app:umanoOverlay="true">

        <ImageView
                android:id="@+id/landmark_iv"
                android:layout_height="match_parent"
                android:layout_width="match_parent"
                android:scaleType="centerCrop"
                android:src="@drawable/sof_tower"/>

        <LinearLayout
                android:id="@+id/dragview"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:background="@drawable/sliding_panel_radius">

            <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/app_name"/>

        </LinearLayout>

    </com.sothree.slidinguppanel.SlidingUpPanelLayout>

0 个答案:

没有答案