gpt4 book ai didi

android - 如何使用带有下拉刷新和滑动删除的Listview

转载 作者:行者123 更新时间:2023-11-30 01:25:39 25 4
gpt4 key购买 nike

我正在使用 this 在我的 bu 中使用滑动删除图书馆。并且还使用滑动来刷新,为此我正在使用 android.support.v4.widget.SwipeRefreshLayout 所以设计很好,当我向下滑动刷新时一切看起来都很好。我的列表得到刷新,内容得到更新。

下面是我的布局

<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"

>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true">
<com.baoyz.swipemenulistview.SwipeMenuListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:dividerHeight="5.0sp"
android:divider="@android:color/transparent"/>

<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center">
<TextView
android:id="@+id/swipeRefreshLayout_emptyView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:visibility="gone"
android:gravity="center"
/></ScrollView>
</FrameLayout>

问题:

因为我想通过滑动删除来删除项目,为此我必须从右向左滑动以打开删除菜单,它会打开但是当我触摸它时没有任何反应。

我现在在结果上,我认为两次手势正在相互拦截。我进行了调试,我的删除项目菜单没有任何内容没有监听点击。

请帮助我卡在中间。你有什么建议可以帮助我吗?

更新一

我调试了代码,当我点击菜单中的删除按钮时,它在日志中显示我在跟踪

D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN

我认为是忽略了我的删除项目的触摸

最佳答案

这里的最佳方式 answer是在开始扫描菜单时禁用 sweipRefreshLayout 并在完成时再次启用它作为这段代码

list.setOnSwipeListener(new SwipeMenuListView.OnSwipeListener() {
@Override
public void onSwipeStart(int position) {
mySwipeRefresh.setEnabled(false);
}

@Override
public void onSwipeEnd(int position) {
mySwipeRefresh.setEnabled(true);
}
});

我希望它对我有用。

关于android - 如何使用带有下拉刷新和滑动删除的Listview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36451957/

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