简体   繁体   中英

set image height and width

How can I set a height and width of a imageView? I doenst work with maxheight and maxwidth...

Here my code:

 <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"
                 />
<ImageView
    android:layout_width="30sp"
    android:layout_height="30sp"
>
</ImageView>

will set width and height to 30 pixels.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM