开发者

Android's flipper won't flip

I made a GridView gallery of image thumbnails, and I want the application to show the selected thumbnail in full size in next screen (full screen).

I have the image in in full size, thus I don't have to re-size it, but the problem that flipper won't flip.

My onItemSelected method looks like this:

public void onItemSelected(AdapterView<?> adapterView,
        View view, int i, long l) {

    if (gridLayout.isActivated()) {
        fullImage.setImageBitmap(
            downloadImage(开发者_如何转开发listOfImages.get(i).getImgURLs()[1].getUrl()));
        flipper.showNext();
    }
}

and the main.xml like this:

<?xml version="1.0" encoding="utf-8"?>
      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/lLayout" android:layout_width="fill_parent" android:layout_height="fill_parent"  android:orientation="vertical">
   <ViewFlipper android:id="@+id/details"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent">
      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/gridLayout" android:layout_width="fill_parent" android:layout_height="fill_parent"  android:orientation="vertical">
    <GridView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/gridView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:columnWidth="90dp"
        android:numColumns="auto_fit"
        android:verticalSpacing="10dp"
        android:horizontalSpacing="10dp"
        android:stretchMode="columnWidth"
        android:gravity="center"  />
      </LinearLayout>
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/oneImageLayout" android:layout_width="fill_parent" android:layout_height="fill_parent"  android:orientation="vertical">
         <Button android:id="@+id/flipMeBack"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:text="Flip Me!"
          />
         <ImageView android:id="@+id/wholeImage"
             android:layout_width="fill_parent"
             android:layout_height="fill_parent"
         />   </LinearLayout>
  </ViewFlipper>
 </LinearLayout>


your code for flipper looks okay to me, maybe the problem is somewhere else. try using this and see if it works.

flipper.setDisplayedChild(1);

If nothing works then try using a view switcher instead of flipper.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜