1つのレイアウト内に2つのscrollView(Roystonが言ったように)を追加する必要があります(結果は、一部の電話では遅れているように見えます)そのためのコードスニペットを次に示します:最初にxmlで
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/myparentScrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ScrollView
android:id="@+id/mychildScrollView"
<TextView
/ >
</ScrollView>
これをコードビハインドに追加します
parentScrollView= (ScrollView) findViewById(R.id.myparentScrollview);
parentScrollView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
//Log.v(TAG,"PARENT TOUCH");
findViewById(R.id.childScrollView).getParent().requestDisallowInterceptTouchEvent(false);
return false;
}
});
childScrollView= (ScrollView) findViewById(R.id.childScrollView);
childScrollView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
//Log.v(TAG,"PARENT TOUCH");
findViewById(R.id.mychildScrollView).getParent().requestDisallowInterceptTouchEvent(true);
return false;
}
});