This article illustrates how Android is programmed to get the screen resolution size of a mobile phone. Share to everyone for your reference, specific as follows:
Import android.app.Activity;
Import Android.os.Bundle;
Import Android.util.DisplayMetrics;
Import Android.widget.TextView;
public class A03activity extends activity {
private TextView mTextView01;
/** called the activity is a. * *
@Overr
first, the basic concept
Dip:density independent pixels, device independent pixels.
DP: Just Dip
PX: pixels
dpi : dots per inch, which is directly the number of pixels in an inch. A common value of 120,160,240. I am generally referred to as pixel density, short density
density : Direct translation of the words seems to be called density. Common values are 1.5, 1.0. Proportional to the standard dpi (160PX/INC)
Resolution: The number of pixel points in 2 directions,
There are more and more Windows Phone devices on the market, and the size and resolution are more and more, especially the WP8.1 era. The people who have done WP development know that application adaptation is actually more simple than Android, one of the important reasons is that Microsoft is claiming that all WP devices will be 2 benchmark resolution to develop, that is, 800:480 and 853:480. wp8+ application adaptation is relatively simple, mainly t
Top 10 practical Android skills: Obtain the physical size, density, and resolution of the screen.
Help me!
The blogger participated in the 2014 blog star event. You can vote for it! Click here!
It is very interesting to know the hardware situation through a program. I studied how to obtain the physical size of the screen
from://http://blog.csdn.net/ithomer/article/details/6688883Android to get the screen longer than the width, referring to the internet has a lot of code, but the results are inconsistent with the actual, such as my phone is i9000, the screen size is 480*800px, the results are 320*533The results are very unreliable, so I wrote a few lines of code, pro-TestTest para
Everybody help!Bloggers participate in 2014 blog star activities, we help vote! Punch here!It is a very interesting thing to know the hardware through the program. I studied the physical size of the screen on WM6.5, but it has not been successful. Later, I wanted to make a breakthrough on Android, but I didn't get the exact size before today. Although many people
I've written earlier how to optimize images under the retina screen.
How to optimize the image under the Retina screen from CSS3 's background-size, this paper introduces the method of Background-size attribute usage, then goes to the point, and introduces the image optimization under the retina
number of 4:3 of the 20 "and 21" screen of the disjunction, but as the 4:3 screen is becoming more and more rare, to buy this resolution screen is increasingly difficult. On the ginger table there is a "UXGA" Dell screen turned straight, and quite convenient.
# QXGA (2048x1536)-QXGA resolution is four times times the
Obtains the screen size except the taskbar height (width ).
Type rectLeft as longTop as longRight as longBottom as longEnd type
Private declare function findwindow lib "USER32" alias "find0000wa" (byval lpclassname as string, byval lpwindowname as string) as longPrivate declare function getwindowrect lib "USER32" (byval hwnd as long, byref lprect as rect) as Boolean
Public sub XX () 'gets the
PX (pixel) pixels, that is, the display point on the screen, in (inch) inch, per inch = 2.54 cm, we often say that a few inches of mobile phones, refers to the phone screen diagonal is a few inch, dpi (dots per inch) the number of pixels, 320x480 screen, If the width is 1 inches, the horizontal dpi is 320/1 (wide), and if the height is 1.5, the vertical dpi is 48
Explanation of dpi/screen-size on androidAndroid defines four screen-size: small normal large xlarge and six dpi levels: ldpi (low )~ 120 dpimdpi (medium )~ 160 dpihdpi (high )~ 240 dpixhdpi (extra-high )~ 320 dpixxhdpi (extra-high )~ 480 dpixxxhdpi (extra-high )~ 640 dpi defines these levels to better organize resourc
obviously not the size of the i9000 screen of the test machine.
Method 3: multiply the results obtained from methods 1 and 2 by the density, and then the perfect 480*800, perfect!
Note:If the density is greater than 1, you must set the targetSdkVersion to 4-9. For example:
However, does this mean that method 3 must be generic?
The answer is no, because I also tested it on the simulator, HTC G14 physical
width: window. Screen. availwidth -------------------
Technical PointsThis section uses the window attributes of the Document Object. The main functions and usage of these attributes are as follows.
To obtain the window size, different properties and methods are required for different browsers: to check the actual size of the window, use the window attribute in
At the beginning, the simulator I selected was WVGA854 with a resolution of 854*480. After the development, I felt very OK when I installed it on a 800*480 mobile phone, but when I installed it on a 480*320 or 320*240 resolution mobile phone, many interfaces were distorted, at this time, I felt the importance of app self-adaptation.
Adaptive mainly encounters two major problems: switching between the landscape screen and the landscape
Screen size1. Different layoutAndroid phone screen size is different, there are 480x320,640x360,800x480. How can I get the app to adapt to various screens automatically? In fact, it is very simple to create a different layout folder in the Res directory, such as: layout-640x360,layout-800x480, all layout files will be compiled after compilation Write to the R.jav
This article describes how to use JS to obtain the screen, browser window size, and webpage height and width. For more information, see document. body. clientWidth.
Visible area height: document. body. clientHeight
Visible area width of the webpage: document. body. offsetWidth (including the width of the edge)
Visible area height of the webpage: document. body. offsetHeight (including the width of the edge)
One, the smartphone operating system, browser, screen size
NetMarketShare Data Site September 2015 smartphone operating system market share rankings. Android platform mobile phone, iOS platform iphone, BlackBerry (BlackBerry), the respective built-in Web browser, as follows:
Android Browser in Android
Mobile Safari in iOS
WebKit browser in BlackBerry
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.