Background image of the android setting window

Source: Internet
Author: User

Differences between drawable-hdpi, drawable-mdpi, and drawable-ldpi:

In Versions later than android2.1, there are three directories: drawable-mdpi, drawable-ldpi, and drawable-hdpi. These three directories are mainly used to support multi-resolution.

DPI is the abbreviation of "dot Per Inch". The number of dots per inch.

Four density classifications: ldpi (low), mdpi (medium), hdpi (high), and xhdpi (extra high)
Normal screen: ldpi is 120, mdpi is 160, hdpi is 240, and xhdpi is 320.

Differences between WVGA, hvga, and qvga
VGA is the "video graphics array", and the display standard is 640*480.
WVGA (wide VGA) Resolution is 480*800
Hvga (half VGA) means half of VGA resolution is 320*480
Qvga (quarter VGA) means that the non-1/4 resolution of VGA is 240*320

 

Drawable-(hdpi, mdpi, ldpi) and WVGA, hvga, qvga contact
Hdpi mainly contains high-resolution images, such as WVGA (480 × 800) and fwvga (480 × 854) aspect ratio:
The mdpi mainly contains medium-resolution images, such as hvga (320 × 480) aspect ratio:
Ldpi mainly uses low-resolution images, such as qvga (240x320) Aspect Ratio
The system will find the corresponding images in these folders according to the machine resolution.

 

To be compatible with different screens on different platforms during development, we can crop the image with a aspect ratio, make sure there is sufficient resolution, and put it in the corresponding directory.

For example, if we want to set the background of our application window, we can simply crop the corresponding image using the specifications mentioned above, and then perform the following steps:

1. Copy the background image to the corresponding drawablefolder. In this case, bg1.png is used.

2. modify main. xml and add Android: Background = "@ drawable/Bg1:

3. The layout file is as follows:

Http://schemas.android.com/apk/res/android"
Android: Orientation = "vertical"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
Android: Background = "@ drawable/Bg1">
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: text = "Hello android"/>

 

References:

Differences between drawable (hdpi, ldpi, mdpi) in android2.1
Http://blog.csdn.net/infsafe/archive/2010/03/29/5426562.aspx

Differences between drawable-(hdpi, mdpi, ldpi) and WVGA, hvga, and qvga in Android Development
Http://disanji.net/2011/04/25/android-development-drawable-hdpimdpildpi-wvgahvgaqvga-diff-connection/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.