Android 安卓&x27;s flipper赢了';t翻转

Android 安卓&x27;s flipper赢了';t翻转,android,viewflipper,Android,Viewflipper,我制作了一个GridView图像缩略图库,我希望应用程序在下一个屏幕(全屏)中以全尺寸显示选定的缩略图 我有完整大小的图像,因此我不必重新调整它的大小,但问题是flipper不会翻转 我的onItemSelected方法如下所示: public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { if (gridLayout.isActivated()) {

我制作了一个
GridView
图像缩略图库,我希望应用程序在下一个屏幕(全屏)中以全尺寸显示选定的缩略图

我有完整大小的图像,因此我不必重新调整它的大小,但问题是flipper不会翻转

我的
onItemSelected
方法如下所示:

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();
    }
}
<?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>
public void未选中(AdapterView AdapterView,
视图,内部i,长l){
if(gridLayout.isActivated()){
fullImage.setImageBitmap(
下载图像(listOfImages.get(i).getImgURLs()[1].getUrl());
flipper.showNext();
}
}
main.xml如下所示:

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

我觉得你的flipper代码没问题,也许问题出在其他地方。 试着使用这个,看看它是否有效

flipper.setDisplayedChild(1)


如果没有任何效果,请尝试使用视图切换器而不是flipper。

这也不起作用。我真的不想使用其他活动,也许有一些我没有添加到应用程序或flipper中的内容?在我的例子中使用flipper对吗?声明x,使用--System.out.println(x);x++;在每一条语句之后,通过查看logcat来确定调用了什么和没有调用什么,x的值将被打印在那里。然后在这里发布结果。我,没有看到你的回复,所以我决定使用视图切换器(这是我第一次使用它,作为flipper to),你能告诉我如何将第二个活动中要显示的图像位图传递给新活动吗。我在internet上找到了一个例子,其中使用一个Intent接收两个参数,其中一个是新活动,这是我传递位图的方式,作为第一个参数(因为它不能排除位图实例)。