2011-02-04 19 views
7

Estoy creando un selector de imágenes desplazable, pero hay algo de información que quiero mostrar para cada imagen mientras scrooling, mi pregunta es, hay un evento en la Galería que me notifica que La imagen está centrada? Este evento debería ocurrir al desplazarse.Evento de la galería a "cuando la imagen está centrada"

Mi diseño es que:

<Gallery android:id="@+id/coverflow" 
     android:layout_width="match_parent" android:layout_height="wrap_content" 
     android:layout_centerInParent="true" /> 
    <TextView android:id="@+id/author" android:layout_width="match_parent" 
     android:layout_height="wrap_content" android:text="Titulo livro" 
     android:layout_above="@id/coverflow" android:gravity="center" /> 

    <ImageView android:id="@+id/div" android:layout_width="match_parent" 
     android:layout_height="wrap_content" android:src="@drawable/library_div" 
     android:layout_above="@id/author" /> 

    <TextView android:id="@+id/title" android:layout_width="match_parent" 
     android:layout_height="wrap_content" android:text="Author" 
     android:layout_above="@id/div" android:gravity="center" /> 
</RelativeLayout> 

quiero cuando pasa de desplazamiento y un nuevo Iten es el del medio, el autor y el título TextViews se actualizan.

¿Algún consejo?

Respuesta

10

En realidad lo encontré:

coverflow.setCallbackDuringFling(true); 
     coverflow.setOnItemSelectedListener(new OnItemSelectedListener() { 
      @Override 
      public void onItemSelected(AdapterView<?> arg0, View arg1, 
        int arg2, long arg3) { 
       Toast.makeText(LibraryActivity.this, "SELECTING "+arg2, Toast.LENGTH_SHORT).show();    
      } 

      @Override 
      public void onNothingSelected(AdapterView<?> arg0) { 
       Toast.makeText(LibraryActivity.this, "NOTHING", Toast.LENGTH_SHORT).show();    
      } 
     }); 
+1

Eso está bien. ¡Gracias! –

+1

GRACIAS @Marcos gracias! mucho –

Cuestiones relacionadas