ScrollView与ListView的焦点问题,互相滑动互不影响
2016-04-15 09:46
309 查看
//布局 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="${relativePackage}.${activityClass}" android:id="@+id/scrollView" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <com.example.test_listview.MyListView android:id="@+id/mylist" android:layout_width="fill_parent" android:layout_height="fill_parent" ></com.example.test_listview.MyListView> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="你猜猜"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="你猜猜"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="你猜猜"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="你猜猜"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="你猜猜"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="你猜猜"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="你猜猜"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="你猜猜"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="你猜猜"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="你猜猜"/> </LinearLayout> </ScrollView>
//代码 ScrollView scrollView=(ScrollView) findViewById(R.id.scrollView); listview.setOnTouchListener(new OnTouchListener(){ @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub if(event.getAction()==MotionEvent.ACTION_UP){ scrollView.requestDisallowInterceptTouchEvent(false); }else{ scrollView.requestDisallowInterceptTouchEvent(true); } return false; } });
相关文章推荐
- 关于ajax解析
- Java实现RC4加解密
- Oracle 获取当前日期及日期格式
- 复利计算评论博客地址
- 图片截取插件Cropper
- 小小图片爬虫
- bzoj 4499: 线性函数
- js中“-”符号的问题
- CFRunLoopObserverRef
- 创建CFRunLoopObserverRef
- error: linker command failed with exit code 1 (use -v to see invocation)
- 使用苹果airport路由器的WDS功能扩展wifi覆盖范围的设置方法
- 翻页特效
- Ubuntu 12.10 安装JDK7
- 【bzoj3790】【神奇项链】【manacher+dp+树状数组】
- jQuery获取cookie值及删除cookie用法实例
- 前端知识大全
- Android天气预报程序(三)
- NSRunloop创建常驻的线程
- 自定义NSOperation