2010-12-31 12 views
0

imageViewの高さと幅を設定するにはどうすればよいですか? 私はここで...のmaxHeightおよびmaxWidthにして画像の高さと幅を設定する

を仕事をdoenst私のコード:

<ImageView 
       android:adjustViewBounds="true" 
       android:id="@+id/weatherIcon" 
       android:src="@drawable/weather_rain" 
       android:paddingLeft="39pt" 
       android:paddingTop="4pt" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"  
       android:scaleType="fitXY" 
       /> 

答えて

0
<ImageView 
    android:layout_width="30sp" 
    android:layout_height="30sp" 
> 
</ImageView> 

は30個のピクセルに幅と高さを設定します。

+0

私の理解が正しい場合は、代わりに "30dip"を使用することができます。私はTextSizeのためだと思った。私はこの方法で試したことはありませんでしたが、私は完全に知らされていない可能性があります。 – FoamyGuy

+0

dpはデバイスの解像度を考慮に入れます。 spはしません。 http://developer.android.com/guide/practices/screens_support.htmlすべてについて説明しています。 – techiServices

+0

@Tim。かなり無関係なコメント... – techiServices

関連する問題