【发布时间】:2014-10-13 16:04:50
【问题描述】:
当位图为 240*240 大小时,如何将ImageView 缩放到设备全屏。
我使用了以下代码。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/layoutBGColor"
android:clickable="true" >
<ImageView
android:id="@+id/fullImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY" />
------
ImageView iv = (ImageView)findViewById(R.id.fullImage);
iv..setImageBitmap(bitmap);
位图是 240*240,位图看起来是分层的。我用谷歌搜索了this 和this,但没有一个起作用。请建议我如何在不分层的情况下全屏设置位图。
【问题讨论】:
-
你想要发生什么?图片小于您的屏幕尺寸,因此要么被拉伸,要么周围有空白区域。
-
不可能,如果位图尺寸小于屏幕,显然需要拉伸以填充它
-
@AleksG 你说的是正确的。请参阅如果我在它(位图)上添加缩放效果,那么它看起来不会被拉伸。我想要这样的东西。我的意思是一些如何显示它的缩放。
-
如何添加缩放效果?您需要了解,没有办法让小图像在拉伸到大屏幕时看起来不错。如果要显示全屏图像,则必须获得高分辨率图像。