2013-07-29 191 views
0

根据屏幕大小,是否可以轻松调整ImageView的大小?我不能在这个上使用drawable,所以对我来说有点困难。我需要平板电脑尺寸为117px×56px,而我需要的手机尺寸为41px×57px。我知道像使用sp这样的东西不会像文本等那样工作,但我无法找到一种方法来做到这一点。忽略我使用的源图像,因为这只是为了制作预览中的大小。完成后它不会有android:src。根据屏幕大小调整ImageView的大小 - Android

代码ImageView的:

<LinearLayout android:id="@+id/thumbnail" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:padding="3dip"  
    android:layout_alignParentLeft="true" 
    android:layout_marginRight="5dip" 
    android:layout_centerVertical="true"> 

    <ImageView  
     android:id="@+id/list_image" 
     android:layout_width="41sp" 
     android:layout_height="57sp" 
     android:src="@drawable/no_image"/> 

</LinearLayout> 

回答

0

也许你可以使用的LinearLayout与重量。作为一个孩子,ImageView的“match_parent”和adjustViewBounds = true和scaleType =“centerCrop”?希望我明白...

相关问题