gpt4 book ai didi

android - 单击面板外部时如何隐藏 Umano SlidingupPanel

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:11:45 25 4
gpt4 key购买 nike

AndroidSlidingUpPanel

在这里,我使用的是滑动面板库。您可以在以下屏幕中同时看到面板和 ListView 。我想做的是,如果我在面板外单击(昏暗区域),则隐藏面板。相反,它是点击上面布局中的 ListView 。我怎样才能做到这一点?

enter image description here

这是 XML,

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.voucher.point.activity"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<!-- sothree:dragView="@+id/dragView" -->

<com.sothree.slidinguppanel.SlidingUpPanelLayout
xmlns:sothree="http://schemas.android.com/apk/res-auto"
android:id="@+id/sliding_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom"
app:fadeColor="@color/transparent"
sothree:panelHeight="40dip"
sothree:paralaxOffset="200dp" >

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white"
android:orientation="vertical" >

<ListView
android:id="@+id/offersList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none"
android:visibility="gone" >
</ListView>

</LinearLayout>

<include
android:id="@+id/bottom_menu"
android:layout_width="fill_parent"
android:layout_height="270dip"
layout="@layout/side_menu" />
</com.sothree.slidinguppanel.SlidingUpPanelLayout>

我可以这样做吗?

最佳答案

对于 3.3.0 及更高版本,可以通过以下方式执行此操作

final SlidingUpPanelLayout slidingUpPanelLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout);
slidingUpPanelLayout.setFadeOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
slidingUpPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
}
});

source

关于android - 单击面板外部时如何隐藏 Umano SlidingupPanel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27201307/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com