【发布时间】:2011-08-31 19:03:17
【问题描述】:
我目前正在从事我的 Android 个人项目。我是android开发的新手,自从我开始自学以来已经有几个月了,但我就是不能专注于这个。好吧,这是我的问题,首先我将讨论到目前为止我所做的:
我在表格布局中为每个 tableRow(六个表格行)放置了 6 个 ImageView,使其成为 6x6 ImageView。
每个 imageView 都有一个默认的图像图标(来自 android drawable 的默认图标)。
单击 ImageView 后,我将使用 setImageDrawable 更改它的 Image。
android 的默认图标大小小于我放置的图像,我认为 36x36 像素是默认图标(android 默认),其中我的图像大小为 80x80 像素。
现在问题来了:
单击图像后,它会成功更改图像,但也会将 imageView 的大小调整为我的图像大小(80x80 像素)。
那么我该如何克服呢?我已经尝试将 ImageView 的比例类型设置为 fitXY,但它仍然没有做任何事情,我的 imageView 已调整大小。
我也尝试将 wrap_content 更改为 fill_parent 但也没有任何反应(我只是认为它可以解决问题,哈哈)
这是我的 ImageView 的属性:
<ImageView android:scaleType="fitXY"
android:id="@+id/imageView1"
android:src="@drawable/image0"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
</ImageView>
有什么帮助吗?提前致谢!
【问题讨论】: