主要涉及到子Scrollview监测父Scrollview的点击事件,做相应的响应。
- <ScrollView
- android:id="@+id/scrollview_f"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:fadingEdge="none"
- android:scrollbars="none" >
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical" >
- <com.example.view.ChildScrollview
- android:id="@+id/scrollview_c"
- android:layout_width="fill_parent"
- android:layout_height="80dp"
- android:layout_gravity="center"
- android:fadingEdge="none"
- android:scrollbars="none"
- android:visibility="visible" >
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="80dp"
- android:gravity="center"
- android:scrollbars="vertical" >
- <TextView
- android:id="@+id/tv_test"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:gravity="top"
- android:scrollbars="vertical"
- android:singleLine="false"
- android:background="@null"
- android:text="Test\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\n" />
- </LinearLayout>
- </com.example.view.ChildScrollview >
- </LinearLayout>
- </ScrollView>
Android:解决ScrollView嵌套ScrollView事件冲突问题
本文介绍如何处理在Android中ScrollView内嵌套ScrollView时,子ScrollView监听并处理父ScrollView的触摸事件,实现当子ScrollView滑动到顶部时,父ScrollView可以继续滚动。
7405

被折叠的 条评论
为什么被折叠?



