首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android平台:如何显示可滚动、可缩放的图像

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

Stack Overflow用户
提问于 2011-08-08 22:57:37
回答 2查看 1.6K关注 0票数 0

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

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

代码语言:javascript
复制
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>
EN

回答 2

Stack Overflow用户

发布于 2011-08-08 23:22:20

您的按键呼叫的onClickLister中的

  1. :

YourImageView.setImageBitmap(YourBitmap);

  • Check out this链接。这是一个关于Android上多点触摸手势基础知识的很棒的教程,它还提供了一个如何移动和缩小图像的示例。
票数 2
EN

Stack Overflow用户

发布于 2011-08-08 23:16:43

有关缩放帖子的信息,请参阅this ImageView。至于如何在单击按钮时更改图像,我建议您阅读here中的如何添加按钮单击侦听器。谷歌"android button onclick example“,你会发现很多例子。如果您仍然不确定如何在单击按钮时更改图像,您应该查看Android Developers Guide,它包含许多有用的信息,如处理事件、UI等。

他们也有一些很棒的教程here。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6984056

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档