【发布时间】:2011-07-02 15:17:18
【问题描述】:
我刚开始学习安卓。而且我不知道如何更改ImageView 的图像?即它有一些在布局中设置的图像,但我想通过编码更改该图像我应该怎么做?
这是xml文件
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#cc8181"
>
<ImageView
android:id="@+id/image"
android:layout_width="50dip"
android:layout_height="fill_parent"
android:src="@drawable/icon"
android:layout_marginLeft="3dip"
android:scaleType="center"/>
感谢回复。
【问题讨论】:
-
您能否说得更清楚一些,在您的问题中,我认为您可能希望在 imageView 中动态显示图像,例如,当我触摸并滑动时,必须显示下一张图像,对吗?