//布局
<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) {
if(event.getAction()==MotionEvent.ACTION_UP){
scrollView.requestDisallowInterceptTouchEvent(false);
}else{
scrollView.requestDisallowInterceptTouchEvent(true);
}
return false;
}
});