2011-02-04 3 views
7

私はスクロール可能な画像ピッカーを作成していますが、スクローリング中に各画像に表示したい情報があります。私の質問はギャラリーにイベントがあります画像は中央に配置されていますか?このイベントはスクロールするときに発生します。私はスクロールが発生し、新しいITENが途中1のとき、著者とタイトルTextViewsが更新取得したいギャラリーのイベントを「画像を中心にする」

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

私のレイアウトは、ということです。

ヒント?

答えて

10

実際に私はそれを見つけた:クールだ

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

を。ありがとう! –

+1

ありがとうございます。とても –

関連する問題