简体   繁体   中英

Why does an image appear blurry on a hdpi screen[running android] when it has been alloted the max possible pixels?

I want to put a 40 X 40 DP icon somewhere on my app's screen. Now according to the ratio (3:4:6:8:12:16) of 6 different logical buckets, I have provided an icon(.png file) with different sizes in 6 different drawable folders .

In my case, the icon sizes must be "MDPI = 40 X 40 PX, HDPI = 60 X 60 PX, XHDPI = 80 X 80 PX and so on" to maintain the same quality across devices at 40 X 40 DP.

After doing so, I'm testing the app on a device with an HDPI screen , which means it should look into the "drawable-HDPI" folder and render an image that basically fills up all the pixels (60 px in a space that has 60px(based on the screen)). But somehow, the icon appears blurry .

What went wrong here??

Meanwhile, I tried putting an icon with much higher pixels(512 x 512 PX) in the HDPI folder and it renders with high quality.

The only confusion is - Despite filling out all the pixels contained in 40 DP on an HDPI display, how an image with more pixels(512) has better quality?

<ImageView
    android:layout_width="40dp"
    android:layout_height="40dp"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:src="@drawable/nameOfImage"/>

Hi you should setup a parameter in Sketchup

check: on mac /sketchup/preference/opengl/show maximum size of texture

on pc /menu/windows/preference/opengl/show maximum size of texture

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