: pixels = dips * (density/160). For example, on a screen with a dpi of 240, 1 dips equals 1.5 physical pixels. We strongly recommend that you use dip to define the layout of your program's interface, as this will ensure that your UI will display properly on screens of all resolutions.To simplify the programmer's face in various resolutions, but also for the various resolutions of the platform can directly run these programs, the Android platform to a
Android phone app icon size specifications and naming specifications are as follows infographic.The Android Icon Specification infographic contains the Android launcher icon, the Android bottom menu icon, the Android Pop-up dialog top icon, the Androchang list internal list item icon, and the Android bottom or Top tab tag icon. Very complete.1. Android Program launch icon: ldpi (+ dpi)Small screen mdpi (DPI
The viewport (viewport), often said in the mobile front, is the screen area where the browser displays the content of the page. Several important concepts involved are the relationship between DPI (device-independent pixel device logic pixels) and CSS pixels.(1) Layout viewport (layouts viewport)The browser of the general mobile device defaults to a viewport meta tag, which defines a virtual layout viewport, which is used to solve the problem of earli
distance, coordinates, Chettu and so on (word level is allowed 0.5pt). Now Store audit even if do not do 1x size can also pass, but IOS engineers in the engraving interface is still 1x as the benchmark, coordinates or something or to use 1x when unit. So the UI in doing @2x big picture or obediently put all the numbers are set to even.
Android is more trouble, screen size and machine species are very many, it is not possible to have a version of each size PSD, usually signed will be included i
To draw this circle-shaded avatar, the individual breaks down into three layers
1, first draw the edge of the avatar gradient
Radialgradient gradient = new Radialgradient (j/2,k/2,j/2,new int[]{0xff5d5d5d,0xff5d5d5d,0x00ffffff},new float[]{0.f , 0.8f,1.0f}, Shader.TileMode.CLAMP);
Paint.setshader (gradient);
Canvas.drawcircle (J/2,k/2,j/2,paint);
2, cut out the round head bitmap
/** * Convert picture into round * @param bitmap incoming Bitmap Object * @return/Public bitmap To
horizontal direction is (nL + nH × 256 ).
. If the number of points exceeds one row, the part that exceeds the maximum number of points (related to the selected bitmap method, see the table below) is ignored.
. D is the bitmap Data byte. If the corresponding bit is 1, The point is printed. If the corresponding bit is 0, the point is not printed. (K indicates the number of data records)
. M is used to select the bitmap method.
M
Mode
Vertical
Horizontal
Points
Reso
different mobile phones, which may cause many problems, such:
1: images are displayed on different devices in different sizes.2: Layout is displayed on different devices and may be deformed.Some basic solutions:
1: Try to use sp as the unit for fonts, and try to use dp or dip for others.2: Use wrap_content, fill_parent, or dp to define the layout size.3: Optimal Proportion of image files corresponding to devices of different density.For devices with four density options: low-
by the camera.
640*480 = 307200 = 0.3 million pixels 1600*1200 = 1920000 pixels 2 million * 3264 = 2488 pixels 8120832*8 million = 4536 pixels 3024*13716864 = 14 million pixels
DPI and PPI
DPI (Dots Per Inch) is used in the printing industry to measure the density of spatial points. This value is the number of ink points that the printer can spray Per Inch. The computer display device draws on the
: pixels = dips * (density/160). For example, on a screen with a dpi of 240, 1 dips equals 1.5 physical pixels. We strongly recommend that you use dip to define the layout of your program's interface, as this will ensure that your UI will display properly on screens of all resolutions.To simplify the programmer's face in various resolutions, but also for the various resolutions of the platform can directly run these programs, the Android platform to a
What is DPI?DPI is the abbreviation for "dot per inch" and the number of pixels per inch.Four density classifications: ldpi (Low), MDPI (Medium), hdpi (High), and xhdpi (extra high)General screen: LDPI is 120,mdpi is 160,hdpi is 240,xhdpi is 320.The DPI calculation formuladpi= diagonal pixel values/dimensionsPhone screen resolution and screen density are differen
Basic terminology
Screen Size: The diagonal length of the actual phone's main screen, such as iphone 4.7 inch;
Resolution: With the computer monitor resolution, such as 1334x750 pixels;
Pixel density (DPI pixels per inch): Compresses the resolution to the screen size, such as the 1334/phone length, such as more than 326 pixels per inch, becomes "retina"
Dip: device independent pixels, is a logical density calculated value, wit
Px: The pixel of the screen.In: inchesMM: mmPT: LB, 1/72 inchDP: an abstract unit based on density. If a screen of DPI is displayed, 1dp = 1px.Dip: equivalent to DPSP: similar to DP, but it also scales according to the user's font size preference.We recommend that you use SP as the unit of text, and dip for others.
The following is an overview of the relationship between DIP and PX:
The following figure shows the resolution information density, which
I believe that every new Android beginner will encounter this problem. I hope this post will not make you tangle any more.Px:
That is, pixels. 1px indicates a physical pixel on the screen;
The unit of PX is not recommended because the actual size of a PX image may be different on different mobile phones, as shown in (the image is from the android developer guide, the same below ).
The occasional use of PX is that when you need to draw a 1 pixel table line or shadow line, other units such as DP
There are many layout units in Android, such as: (DP, SP, PX, In, PT, and mm). But what is the difference between them? When should I use it again? I think even experienced developers sometimes cannot understand it.
DPI (DOT per inch): used to describe the screen density. For example, if the screen density is 160, there are 1 inch display points per 160.
In (inch): indicates the inch, which is the physical size of the screen. Equal to 2.54 per inch
C
.
640*480 = 307200 = 0.3 million pixels 1600*1200 = 1920000 pixels 2 million * 3264 = 2488 pixels 8120832*8 million = 4536 pixels 3024*13716864 = 14 million pixels
DPI and PPI
DPI (Dots Per Inch) is used in the printing industry to measure the density of spatial points. This value is the number of ink points that the printer can spray Per Inch. The computer display device draws on the
TheProgramYou can test the resolution of a personal mobile phone device, which DPI level is used for development reference.
Main. xml
String. xml
JavaCode:
Package COM. shine. android; import android. app. activity; import android. OS. bundle; import android. util. displaymetrics; import android. view. view; import android. view. view. onclicklistener; import android. widget. button; import android. widget. edittext; public class androidd
better use two sets of resource images as much as possible;
Question 2: When visual design is based on the interaction prototype, you can consider the mdpi, that is, the 320x133 blueprint for design, because Android generally uses DP as the unit, in our design, PX is usually the unit, which involves a unit conversion problem. In mdpi, the relationship between PX and DP is, in this way, the unit conversion can be easily performed when the coordinates are marked. For example, if we use 320x133
Today this Tencent game seven treasure classmate of dry goods, not only to the students of absolute/relative length units, screen size/resolution/pixel density, ppi/dpi/sp/px, and a series of basic terminology, but also the most important to move the page to reconstruct the knowledge point viewport in-depth explanation, the whole professional dry goods, Designer, Collect!
Just start to contact mobile page refactoring, is not very confused should be a
pixel can only have one color (for simplicity, the sub pixel anti-aliasing technique is not discussed here), to be displayed on the screen, you must first convert the length in PT to the length in pixels, which is the media of the conversion, which is the DPI (in fact, The so-called DPI here is the term used in operating systems and browsers, which is PPI, pixels per inch, and the
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.