ViewFLipper Inside ViewFlipper

635 views Asked by At

I'm working on a project where I require viewFlipper inside another

<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>

,where second view flipper will have some dynamically added view,and it open as a second window or popup,but not able to understand how to disable parent Viewflipper when child Viewflipper is active and vice versa, secondly the dynamically added views to 2nd ViewFlipper ,are Libgdx animations,so how to run them on swipe,kindly guide new in android,libgdx

1

There are 1 answers

0
nikvs On

You can disable the touch listener of parent view flipper when the focus is on child and vice versa. sample-

  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;
            }
        });