Флиппер Android не перевернется - PullRequest
1 голос
/ 23 июля 2011

Я создал галерею 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 вот так:

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

1 Ответ

0 голосов
/ 23 июля 2011

Ваш код для флиппера выглядит хорошо для меня, возможно, проблема в другом.попробуйте использовать это и посмотрите, работает ли это.

flipper.setDisplayedChild (1);

Если ничего не работает, попробуйте использовать переключатель представления вместо flipper.

...