Android ScrollView嵌套ScrollView滚动的问题解决办法
2016-11-22 14:39
351 查看
布局中
<ScrollView
android:id="@+id/scrollview_parent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="false"
android:scrollbars="none" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollview_child"
android:layout_width="fill_parent"
android:layout_height="250dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:scrollbars="none" >
</ScrollView>
</LinearLayout>
</ScrollView>
代码中。。。
parentScrollView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
findViewById(R.id.scrollview_child).getParent().requestDisallowInterceptTouchEvent(false);
return false;
}
});
childScrollView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event)
{
v.getParent().requestDisallowInterceptTouchEvent(true);
return false;
}
});
<ScrollView
android:id="@+id/scrollview_parent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="false"
android:scrollbars="none" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollview_child"
android:layout_width="fill_parent"
android:layout_height="250dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:scrollbars="none" >
</ScrollView>
</LinearLayout>
</ScrollView>
代码中。。。
parentScrollView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
findViewById(R.id.scrollview_child).getParent().requestDisallowInterceptTouchEvent(false);
return false;
}
});
childScrollView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event)
{
v.getParent().requestDisallowInterceptTouchEvent(true);
return false;
}
});
相关文章推荐
- Android ScrollView嵌套ScrollView滚动的问题解决办法
- Android ScrollView嵌套ScrollView滚动的问题解决办法
- 配置android环境遇到的问题及解决办法
- Android adb logcat cmd 中文乱码 ----- bat批处理文件不能执行 -- 问题的解决办法
- Android ListView滚动Item背景为黑色解决办法
- 移植cocos2d-x 游戏从Android平台到IOS平台分辨率问题及解决办法
- Android的listview滚动时背景不让变黑解决办法
- android 解决wifi断线不稳定的问题-终极办法
- 关于android开发遇到的一些问题的解决办法---间断的更新
- Android中使用cmwap接入点访问互联网的问题及解决办法
- Android ListView滚动Item背景为黑色解决办法
- Android手机常见问题以及解决办法[非开发]
- android 导入的一些常见问题的解决办法。
- Android ListView滚动Item背景为黑色解决办法
- 自己在使用Android Maps API 开发地图应用程序时遇到的问题,以及解决的办法
- Android2.2+Eclipse windows xp环境配置,加部分问题解决办法(图文)
- android TranslateAnimation中闪烁及点击问题的解决办法
- 第一个android程序以及遇到问题解决办法
- android 解决wifi断线不稳定的问题-终极办法
- android listview选中某一行,成选中状态颜色高亮显示,ListView的UI显示中常见问题及解决办法