简体   繁体   中英

how to make images fit in all different screens in android ? I need images with 440x300dp,check out my screenshots

how to make images fit in all different screens in android? I need images with 440x300dp and I created mdpi etc folders to place images,check out my screenshots and help me to solve this one

I need images to fill match parent of width and height should be 300dp but these mdpi,hdpi..etc not having it, I'm confused

在此处输入图像描述 enter image description here

在此处输入图像描述

Thank you..

if you need ImageView with fixed size then just use fixed size

android:layout_width="440dp"
android:layout_height="300dp"

DON'T use layout_weight / weightSum params at all, with it you won't ever achieve what you want.

and after that use android:scaleType param to fulfil your View . check out THIS visual tutorial for picking proper type

laso all your drawables should have proper ratio, eg mdpi drawable may have 440px x 300px, hdpi x1.5, so 660px x 450px, xhdpi x2 and so on. some nice tutorial about density buckets in HERE

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