2012-08-04 82 views
-1

我想缩放从SD卡加载到图像视图的图像。如何将从SD卡加载的图像缩放到图像视图?

问题是每当我从SD卡加载图像作为全屏幕,我已经设置所有参数fill_parent viewbounds scaletype等按其他问题。

应该怎么做?

<ImageView 
    android:id="@+id/imageView2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignBottom="@+id/Frame" 
    android:layout_alignLeft="@+id/Load1" 
    android:adjustViewBounds="true" 
    android:cropToPadding="true" 
    android:scaleType="fitXY" 
    android:src="@android:drawable/alert_light_frame" /> 

<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_centerHorizontal="true" 
    android:layout_marginBottom="14dp" 
    android:scaleType="fitXY" 
    android:src="@android:drawable/alert_light_frame" /> 

这是我的图像视图代码u能告诉我什么改变,使图像根据ImageView的大小

+0

你能还添加代码,你怎么把它变成一个'ImageView'? – tolgap 2012-08-04 23:10:42

回答

0

使用fitCenter scaleType来。在您的布局定义,请您ImageView小号

android:scaleType="fitCenter" 
+0

我已经尝试DIS也可以建议一些其他方法 – 2012-08-05 11:51:51

+0

你可以发布完整的布局代码?图像的尺寸(宽度/高度)是多少? – 2012-08-05 12:55:34

+0

实际上图像是动态加载从画廊,所以我不知道图像的尺寸是什么。 – 2012-08-05 13:22:07