我正在做一个项目,我需要在另一个项目中使用viewFlipper
<RelativeLayout> <ViewFlipper
android:id="@+id/MainFlipper"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/MainLinear1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:src="@drawable/img_01" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:layout_marginTop="200dp"
android:text="Good "
android:textColor="@android:color/white"
android:textSize="40sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/LinearSc2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="70dp"
android:orientation="horizontal" >
<Button
android:id="@+id/bbottle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="60dp"
android:layout_marginTop="120dp"
android:background="@drawable/cbse_g08_s02_l02_t02_sc02_img_01" />
</LinearLayout>
<ViewFlipper id="2ndVF>
</ViewFlipper>
<RelativeLayout>,其中第二个视图翻转将有一些动态添加的视图,它作为第二个窗口或弹出窗口打开,但不能理解如何禁用父视图翻转当子视图翻转是活动的,反之亦然,其次,动态添加到第二个Viewflipper的视图是Libgdx动画,所以如何在滑动上运行它们,请指导android中的新功能,libgdx
发布于 2013-12-20 13:59:15
当焦点在子对象上时,您可以禁用父视图翻转程序的触摸侦听器,反之亦然。示例-
parentViewFlipper.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
chieldViewFlipper.getParent().requestDisallowInterceptTouchEvent(false);
return false;
}
});
childViewFlipper.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View view, MotionEvent event) {
view.getParent().requestDisallowInterceptTouchEvent(true);
return false;
}
});https://stackoverflow.com/questions/20696966
复制相似问题