简体   繁体   中英

Background Dimensions for iOS and Android

I am using a 640(w) x 960(h) background for mobile web app using default browser on iOS and Android devices. Is this the correct dimensions?

How do I set my background so that it scales to different device widths and heights?

Instead of using px(pixels) while setting the dimensions in your code, use dp or dip(Density-independent Pixels).

"dp" units are relative to a 160 dpi screen. So one dp is one pixel on a 160 dpi screen.The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion.

When this unit is used, your image is scaled to according to the dimensions of different devices.

Here's a link to this: http://developer.android.com/guide/practices/screens_support.html

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