1

使用 imageview 的 XML 文件在一个鳍状肢中有 16 个图像。

    <ImageView android:id="@+id/imageView3"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:src="@drawable/c" />

    <ImageView android:id="@+id/imageView4"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:src="@drawable/d" />

    <ImageView android:id="@+id/imageView5"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:src="@drawable/e" />

    <ImageView android:id="@+id/imageView6"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:src="@drawable/f" />

    <ImageView android:id="@+id/imageView7"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:src="@drawable/g" />

    <ImageView android:id="@+id/imageView8"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:src="@drawable/h" />

    <ImageView android:id="@+id/imageView9"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:src="@drawable/i" />

    <ImageView android:id="@+id/imageView10"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:src="@drawable/j" />

    <ImageView android:id="@+id/imageView11"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:src="@drawable/k" />

    <ImageView android:id="@+id/imageView12"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:src="@drawable/l" />

    <ImageView android:id="@+id/imageView13"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:src="@drawable/m" />

    <ImageView android:id="@+id/imageView14"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:src="@drawable/n" />

    <ImageView android:id="@+id/imageView15"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:src="@drawable/o" />

    <ImageView android:id="@+id/imageView16"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:src="@drawable/p" />                

</ViewFlipper>

公共类 MainActivity 扩展 Activity 实现 OnClickListener {

ViewFlipper 翻转;

@Override

protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Flippy=(ViewFlipper)findViewById(R.id.viewFlipper1);
    Flippy.setOnClickListener(this);

}

@覆盖

公共无效 onClick(查看 v){

Flippy.showNext();

}

}

无法在它停止的设备上工作

4

0 回答 0