Android平台:如何显示可滚动、可缩放的图像

Android平台:如何显示可滚动、可缩放的图像,android,Android,我有一组8张图片,我想按顺序一张一张地展示。单击按钮后,将显示下一个图像 我可以在imageview中加载我的图像。 1.我找不到如何在单击按钮时更改图像 2.如何在程序中进行更改,使图像可搜索和缩放 enter code here <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" androi

我有一组8张图片,我想按顺序一张一张地展示。单击按钮后,将显示下一个图像

我可以在imageview中加载我的图像。 1.我找不到如何在单击按钮时更改图像 2.如何在程序中进行更改,使图像可搜索和缩放

enter code here
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:layout_weight="1">
  <ImageView
  android:id="@+id/imageview1"
  android:gravity="center_horizontal"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:layout_weight="1"
  android:src="@drawable/img1"      
  android:adjustViewBounds="true"
  android:keepScreenOn="true" 
  android:scrollbarStyle="outsideOverlay"
  android:scrollbars="horizontal" android:scaleType="fitXY"/>
  <Button      
  android:layout_height="wrap_content"
  android:layout_width="fill_parent"
  android:id="@+id/button1"
  android:text="Next"/>
</LinearLayout>
在此处输入代码

有关缩放图像视图,请参阅文章。至于如何在单击按钮时更改图像,我建议您阅读如何添加按钮单击侦听器。谷歌“安卓按钮点击例子”,你会发现很多例子。如果您仍然不确定如何在单击按钮时更改图像,您应该查看,它有许多有用的信息,如处理事件、用户界面等

他们也有一些很棒的教程

  • 在按钮调用的
    onClickLister
    中:
    YourImageView.setImageBitmap(YourBitmap)

  • 查看链接。这是一个关于Android上多点触摸手势基础知识的很棒的教程,它还提供了一个如何移动和缩放图像的示例