AndroidTwo smart pointer types are defined, one is strong pointer Sp (Strong pointer), The other is the weak pointer (Weak pointer). In fact, it is more suitable for strong references and weak references. Strong pointers share the same concept as smart pointers in general sense. The reference count is used to record how many users are using an object. If all users give up referencing this object, the object will be automatically destroyed.
The weak
just a measure of the pixel density. Third, DPIndependent of the physical density of the unit of measurement, it is based on 160dpi , regardless of the DPI screen, 1DP represents the same physical length. In the 160dpi screen, 1DP=1px, that is, a DP needs to be represented by an PX , on the 240dpi screen, 1DP=1.5px, indicating a DP needs 1.5 px to indicate. That is to say 1DP=dpi/160*px. The implication is that developers will be able to develop a UI that displays the same size, regardless of t
[Dip:device independent pixels (device independent pixel).
Different devices have different display effects, this is related to the device hardware, we generally support the WVGA, HVGA and QVGA recommended to use this, do not rely on pixels.
Px:pixels (Pixel). Different devices display the same effect, generally we hvga represent 320x480 pixels, this use more.
Pt:point, is a standard length unit, 1pt=1/72 inches, used in the printing industry, is very simple and easy to use;
sp:scaled pixels
). Different devices have the same display effect on different display screens. This is an absolute pixel, and the value will never change.3. SP: scaled pixels (zoom in pixels). It is mainly used to display the best for textsize in the font.
4. Pt (points) -- LB: 1pt = 1/72 inch
Dip should be used as much as possible during layout, and PX should be used less, because different devices have different resolutions and affect visual effects. We recommend
Dip: Device Independent pixels (device independent pixel ). different devices have different display effects, which are related to the hardware of the device. We recommend that you use this function to support WVGA, hvga, and qvga without pixels.
Px: pixels (pixels). Different devices have the same display effect. Generally, we use hvga to represent 320x480 pixels, which is usually used.
PT: point, a standard unit of length, 1pt = 1/72 inch, used in the printing industry, very easy to use;
Differences between Android px, dp, and sp
Since the rise of Android, developers have been increasing, while devices on the market are also increasing. What follows is the troubles and complaints that developers need to adapt to a large number of models. With the customization of different ROM devices from different manufacturers, the fragmentation of Android devices is becoming increasingly serious. This article describes how to design an Android pag
mark advertising, was banned by the government, and find click Ads, sales flow and other money-making models. But most of these personal webmaster are crazy, it is the SP company to the Internet infiltration brought about the chance of wealth.
The use of Short Message Alliance to make money is actually very simple: Internet users as long as the number of input mobile phone, SP Company may be charged to the
SQL is translated as per-case basis,sp means a stored procedure, an ORM is an object-relational map, such as HibernateOne, EvolutionAt first, only SQL statements, which can be executed in an interactive sentence, can also be executed in batch mode, and multiple rows of SQL statements are committed at a time.It was soon discovered that a bunch of SQL languages executed in batch mode could be stored in the database in the form of a process, which became
, TextView's font size is best to use SP to do units, and view the source of TextView know that Android by default using the SP as the font size units. Usage Recommendations:According to Google's recommendation, pixels uniformly use the dip, the font unified use SPIn order for the user interface to display properly on the current and future display types, we recommend that you always use the
Android the PX , Dip , SP the DifferenceWe often set the length of the container in the layout of the page, but it is annoying to use which unit is the length.There are several types of description size areas that are supported in Android:PX (pixels)--Pixels: Different devices display the same effect, generally we hvga represent 320x480 pixels, this use more.Dip (device independent pixels)--equipment independent pixels: This is related to device hardw
[Dip: device independent pixels (device independent pixel ).
Different devices have different display effects, which are related to the hardware of the device. We recommend that you use this function to support WVGA, HVGA, and QVGA without pixels.
Px: pixels (pixels). Different devices have the same display effect. Generally, we use HVGA to represent 320x480 pixels, which is usually used.
Pt: point, a standard unit of length, 1pt = 1/72 inch, used in the printing industry, very easy to use;
Recently, I've seen a lot of blog posts about conversion between DP-PX,PX-DP,SP-PX,PX-SP, and the way I used to do it was:1//Conversion dip for PX 2 public static int Convertdiporpx (context context, int dip) { 3 float scale = CONTEXT.GETRESOURC Es (). Getdisplaymetrics (). density; 4 return (int) (Dip*scale + 0.5f* (dip>=0?1:-1)); 5} 6 7//convert PX to dip 8 public static int Convertpxordip
²+ width pixels ²)/Screen diagonal inches dp:density-independent pixels, with 160PPI screen as standard, then 1dp=1px, DP and px conversion formula: dp*ppi/160 = px. such as 1DP x 320ppi/160 = 2px. sp:scale-independent pixels, which is the font unit for Android, is the standard 160PPI screen, when the font size is 100%, 1sp=1px. SP and px conversion Formula : sp*ppi/160 = px conclusion: px = dp*ppi/16
Dip: Device Independent pixels (device independent pixel ). different devices have different display effects, which are related to the hardware of the device. We recommend that you use this function to support WVGA, hvga, and qvga without pixels.
Px: pixels (pixels). Different devices have the same display effect. Generally, we use hvga to represent 320x480 pixels, which is usually used.
PT: point, a standard unit of length, 1pt = 1/72 inch, used in the printing industry, very easy to use;
From: http://shixin20051108.blog.163.com/blog/static/324833232010101234342417/
[Dip: Device Independent pixels (device independent pixel ). different devices have different display effects, which are related to the hardware of the device. We recommend that you use this function to support WVGA, hvga, and qvga without pixels.
Px: pixels (pixels). Different devices have the same display effect. Generally, we use hvga to represent 320x480 pixels, which is usually used.
PT: point, a standar
Android is a headache adaptation problem.---------The units in Android probably have these:Dip, SP, often used. Sometimes the PX is used.---------Two classes are introduced:Typedvalue: There are some units that convert related methods.Displaymetrics:Displaymetrics dm = new Displaymetrics (); Getwindowmanager (). Getdefaultdisplay (). Getmetrics (DM);Displaymetrics have these units to convert related fields:---------Their relationship:Dip = displaymetr
Dip:device independent pixels (device independent pixel). Different devices have different display effects, this is related to the device hardware, we generally support WVGA, HVGA and QVGA CWJ recommended Use this, do not rely on pixels.Px:pixels (Pixel). Different devices display the same effect, generally we hvga represent 320x480 pixels, this use more.Pt:point, is a standard length unit, 1pt=1/72 inches, used in the printing industry, is very simple and easy to use;sp:scaled pixels (zoom in p
Difference between dip, dp, sp, pt and px in Android, androiddip
Dip: device independent pixels (device independent pixel ). different devices have different display effects, which are related to the hardware of the device. We recommend that you use this function to support WVGA, HVGA, and QVGA without pixels.Dp: dip is the samePx: pixels (pixels). Different devices have the same display effect. Generally, we use HVGA to represent 320x480 pixels, whi
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.