こんにちは友達私はトラビスのビデオを見てアンドロイドを学び始めたところです。
彼は、画像スライダーを含むアプリを作成しました。私はすべてのステップを実行し、すべてが正常に機能しています。彼は使用しました
以下は私のXMLコードです。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/IVDisplay"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:layout_gravity="center"
android:src="@drawable/a"
/>
<Button
android:id="@+id/setBG"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/set_as_wallpaper" />
<HorizontalScrollView
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fillViewport="true"
android:scrollbars="horizontal|vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="@+id/viewImage1"
android:layout_width="125dp"
android:layout_height="125dp"
android:padding="15dp"
android:src="@drawable/a" />
<ImageView
android:id="@+id/viewImage2"
android:layout_width="125dp"
android:layout_height="125dp"
android:padding="15dp"
android:src="@drawable/c" />
<ImageView
android:id="@+id/viewImage3"
android:layout_width="125dp"
android:layout_height="125dp"
android:padding="15dp"
android:src="@drawable/d" />
<ImageView
android:id="@+id/viewImage4"
android:layout_width="125dp"
android:layout_height="125dp"
android:padding="15dp"
android:src="@drawable/e" />
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
画像は正しく表示されています...しかし、一度に表示できる画像は1つ半しかありません...他にも多くの画像があります...そこで、HorizontalScrollViewを使用して画像をスライドするスライダーを表示しています。
これは私が参照したビデオですhttp://www.youtube.com/watch?v=wp5sORsPopw