3

x秒ごとに画像を変更するImageSwitcherがあります。
setImageDrawableを使用して画像をスイッチャーに設定すると正常に動作します。ただし、画像は垂直方向の中央に配置されていません。以下は私のレイアウトです

    <RelativeLayout
           android:id="@+id/galleryimage"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"  
           android:background="@drawable/gallerymain2"
           android:clipToPadding="true"
           android:padding="5dp" >

           <ImageSwitcher
                 android:id="@+id/image_switcher"
                 android:layout_width="fill_parent"
                 android:layout_height="wrap_content"
                 android:foregroundGravity="center"   />
    </RelativeLayout>

次に、代わりにswitcher.setForegroundを使用しました。適切に配置されますが、アニメーションが開始されません。これを修正する方法を知っている人はいますか?ありがとう

4

1 に答える 1