【发布时间】:2015-05-12 12:43:58
【问题描述】:
我的ExpandableListView 无法正常滚动;
我只能在 ListView 不动时滚动它,这对于快速导航来说非常烦人。
一旦滚动开始运动,我就无法控制它,直到它不再移动。
我使用eventListView.expandGroup(0); eventListView.expandGroup(1); ... 来扩展所有组。
xml 也没什么特别的:
<ExpandableListView
android:id="@+id/event_list"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:paddingBottom="90dip"
android:clipToPadding="false"/>
ListView 有一个适配器和一个OnChildClickListener,差不多就是这样。我到处搜索,但似乎找不到答案,有人可以帮忙吗?
该视图的完整 xml 代码:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/timetable"
android:background="@color/bg_white">
<include android:id="@+id/placeholder_events"
layout="@layout/placeholder_layout"/>
<ExpandableListView
android:id="@+id/event_list"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:paddingBottom="90dip"
android:clipToPadding="false"/>
<ImageButton
android:layout_width="56dp"
android:layout_height="56dp"
android:src="@drawable/icon_left_arrow"
android:layout_gravity="left|bottom"
android:layout_marginLeft="16dp"
android:layout_marginBottom="16dp"
android:id="@+id/timetable_previousWeek_button"
android:elevation="1dp"
android:background="@drawable/floating_action_button"/>
<ImageButton
android:layout_width="56dp"
android:layout_height="56dp"
android:src="@drawable/icon_right_arrow"
android:layout_gravity="right|bottom"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
android:id="@+id/timetable_nextWeek_button"
android:elevation="1dp"
android:background="@drawable/floating_action_button"/>
</FrameLayout>
编辑
对于遇到这个问题的其他人,我有一个手势侦听器,用于左右滑动,滚动时会得到焦点。所以基本上那个听众搞砸了上下滚动。
【问题讨论】:
-
请发布您的代码,以便我们能够指出错误,有时当您在滚动视图中使用 listivew 等时会发生这种情况,如果是这样,请告诉我我会解决的。
-
当然,谢谢。对我来说似乎很标准的 xml,但你是对的,你永远不知道。
-
您的代码看起来不错。您的ListView不正常滚动,或者您希望ListView的软刷新,如果是,我发布了我的答案。一旦我使用ListView内部scrolview,那么它根本没有移动,因为它中断了scrolview。 span>
-
对于其他遇到此问题的人,我有一个手势监听器,用于从左到右滑动,在滚动时获得焦点。所以基本上那个听众搞砸了上下滚动。