Skip to content Skip to sidebar Skip to footer

View Flipper Is Not Flipping

Is this even possible? I created this view flipper and I am calling the view flipper from the onClick inside of the xml layout. I have created a view flipper before but for some re

Solution 1:

setDisplayedChild takes an index, not an id.

Solution 2:

before on create

ViewFlippermViewFlipper= (ViewFlipper)findViewbyId(location);

on your onCreate() or onStart

Ensure that whatever your layout on setcontentView(R.layout.something) does contain the view flipper

Also try this for me. before this line mViewFlipper.setDisplayedChild(ViewFlipperModes.MAIN.index()); Type in:

int i = (ViewFlipperModes.MAIN.index()); place a debug point here
mViewFlipper.setDisplayedChild(i);

I also suggest using the debugger to try figure out if your flip views events are being called inside the debugger.

<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/book_as_whole_Layout"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"android:background="#FFFFFF"><ViewFlipperandroid:layout_marginTop="20dip"android:layout_marginLeft="20dip"android:layout_marginRight="20dip"android:layout_width="match_parent"android:layout_height="match_parent"android:id="@+id/ViewFlipper"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"><TextViewandroid:id="@+id/page1"android:text="@string/loading_string"android:layout_width="match_parent"android:layout_height="match_parent"android:textColor="#000000"android:typeface="serif"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"><TextViewandroid:id="@+id/page2"android:text="@string/loading_string"android:layout_width="match_parent"android:layout_height="match_parent"android:textColor="#000000"android:typeface="serif" /></LinearLayout></ViewFlipper></LinearLayout>

Post a Comment for "View Flipper Is Not Flipping"