简体   繁体   中英

app crashes when opening multiple image

I am making an app for story books, i have my curlview animation for this app.

My problem is that i dont know what size of image and what resolution should i use for 3.5 inches to 5.0 inches screen.

I always reading on supporting multiple screen size but the problem is that i cannot get that.

All i want is the exact image size in pixel and what is the resolution should i use.

i always use 72 as resolution but i dont know what is the dimension should i use for 3.5 to 5.0 inches screen size.

did anyone knows what should i use? i dont want to read supporting multiple screen size because i already read it and i did not get it.

Thank you to someone who can give me the size i should use that will not get crash in my app.

Thanks again!

As it said in the Android style guide icon size scale for different screens should follow the 2:3:4:6 scaling ratio. Maybe you can use this ratio for other, not only icon, images too.

As you write you read the documentation, I assume you already read the Android Best Practices Chapter about Density Independence . If I got your question right, you're looking for the following part of it:

  • The system scales dp units as appropriate for the current screen density.

  • The system scales drawable resources to the appropriate size, based on the current screen density, if necessary

[...] By default, Android scales your bitmap drawables (.png, .jpg, and .gif files) [...] so that they render at the appropriate physical size on each device.

So you basically need to provide an screen-size independent layout, and Android takes care of the rest. However it is encouraged to deliver multiple images for a better scaling quality.

If you can only afford a single size for the images, I'd decide on a target audience (eg how likely are Tablet users, what is the average device's screen size in my audience -> how many pixels will be available in the area you want to display the image) and then calculate the resolution of the images based on that. If a user needs a smaller or larger version, Android will scale the image up or down, given your layout is correct.

From what you write, it seems to me like you're targeting normal screen sizes, so you can have something between 470dp x 320dp and 640dp x 480dp. To get regular pixels, you must think about the screen density of your users, refer to a Question about dp/px conversion for details.

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