Android density[Turn] +gentoo system time adjustment [Turn]__android

Source: Internet
Author: User
Tags lowercase
1. What is density

1) Density

Density represents the number of display points per inch (logical value), its unit is DPI:DOT/inch, usually large screen, density large, screen hours, density small, usually

When the actual screen resolution is 240px*400px, density=120

The actual screen resolution is 320px*533px,density=160

The actual screen resolution is 480px*800px,density=240

2) Resolution

Is the whole screen is how many points, such as 800x480, it is the software display unit

3 support density from Android1.6 version (corresponding API level 4)

Used to troubleshoot problems that are normally displayed on hardware with different screen sizes

2. Related Code and Setup

1) androidmanifest.xml

<supports-screens android:anydensity= "true"/>

&LT;USES-SDK android:minsdkversion= "4" ></uses-sdk>

This parameter is enabled after API level 4, SDK 1.6, and the default value of API level 4 for version 1.6 is true

2 Resource Directory name (after Android 2.0)

res/xxx-hdpi when density is 240, use the resources in this directory

res/xxx-mdpi when density is 160, use the resources in this directory

res/xxx-ldpi when density is 120, use the resources in this directory

res/xxx suffix, for default settings, with XXX-MDPI

3 Resource Units (units of size defined in XML file)

A) dp=dip=dx (density independent pixel)

An abstract unit based on screen density, a device-independent point that describes dimensions and locations that are not density-independent. These units are relative to a 160dpi screen, and all a DP is a point on the 160dpi screen.

b) px

PX refers to the unit point of the software, device-related points

c) Specific use

I. Layout when using unit dip, less use px

If you use PX, if you set a control size 400x400px, on the 800x480 display Normal, and on the 533x320 screen is beyond the screen

If you use a DP, if you set a control size of 160X160DP, you can take density from the system to calculate the real size, such as the 800x480 screen density set to 240, and the 533x320 screen is set to 160, to calculate the formula

pixels = dips * (density/160)

The 800x480 displays 240 pixels in the screen and 160 pixels in the 533x320 screen, and the control displays the same proportions in the screen.

Ii. the internal processing process is divided into three steps:

Take the other elements of screen into the applied values, calculate the position of each control, and then turn to 800x480 for real display

If Res-xxx does not exist, read the resources in the RES and scale them accordingly

3. Realize the key source of density

1) Bitmapfactory.java (for scaling pictures)

2) Comptibilityinfo.java (for position calculation)





system time adjustment in Gentoo [turn]

First familiarize yourself with the use of the date command:
# date
October 9, 2007 Tuesday 23:07 05 sec CST
# date "+%y.%m.%d%h:%m:%s"
2007.10.09 23:07:05
It is easier to mix the lowercase and uppercase of M, the lowercase refers to the month, and the capitalization refers to the minute.

Date allows you to manually adjust the current time, for example, July 21, 2008 13:00:
# date 072113002008

You can connect to the National Time Service Center server to get the exact timing and download NTP in Gentoo:
# emerge NTP
# ntpdate 210.72.145.44
# Hwclock--SYSTOHC

To set the time zone in/etc/conf.d/clock:
clock= "Local"
Timezone= ' Asia/shanghai '
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.