Android screen adaptation, Android
To sum up your screen adaptation experience, I only hope that I can continue to improve and improve. If you have a warm-hearted "predecessors" to guide me, I am very grateful!
Android 5.0 has already come out, saying that this version has d
The following describes how to obtain screen-related information in Android.
1. screen size, source code:
Displaymetrics metrics = new displaymetrics (); getwindowmanager (). getdefadisplay display (). getmetrics (metrics); int screenwidth = metrics. widthpixels; // screen width int screenheight = metrics. heightpixel
);ComponentName = new ComponentName (this, myreceiver.class);if (policymanager.isadminactive (componentname)) {//To determine if a permission is available (Device Manager activated)Policymanager.locknow ();//Direct lock screenFinish ();} else {Activemanager ();//Activate Device Manager Get PermissionsFinish ();}}/*** Get lock Screen permissions*/private void Activemanager () {Activates the specified Device Manager using implicit intent to invoke the s
1. Set style ///1, set the background map theme 1 2. Set Transparent theme1 I've defined two types of theme, the first of which is to set a background map. When the program starts, this background image is displayed first to prevent a black screen from appearing. The second kind of theme is to set the style to transparent, the program will not be black screen after startup, but the whole transparent, wait u
Android development skills-similar to the new version of QQ screen lock pop-up window, android development skills
The new version of qq can display qq messages in the pop-up window under the screen lock. This function is also required for projects currently in progress. After a variety of experiments and data searches,
First, one thing to say is that in Android, the width of the canvas canvas is actually the height of the screen.
As a result, there are many ways to get a high screen width:
WindowManager WindowManager = Getwindowmanager ();
Display display = Windowmanager.getdefaultdisplay ();
ScreenWidth = Display.getwidth ();
Screen
Two Methods for android startup screen: android
Now, when we open any app, most of them will display a startup interface, displaying the company's logo and current version, and some will directly put the advertisement on it. The startup screen can be set in two ways:One is the implementation of two activities.,And a At
On a DPI mobile phone, 1dp = 1px; on a 320dpi mobile phone, 1dp = 1.5px
Android obtains the screen size and density
In some cases, we need to obtain the physical size of the screen of the Android mobile phone or Pad to facilitate the interface design or other functions. The following describes how to obtain the physi
;
return (int) (Dipvalue * scale + 0.5f);
}
public static int Px2dip (context context, float Pxvalue) {
Final float scale = Context.getresource (). Getdisplaymetrics (). density;
return (int) (Pxvalue/scale + 0.5f);
}
here's how to get the resolution:
In the OnCreate method of an activity, write the following code:
Copy Code code as follows:
Displaymetrics metric = new Displaymetrics ();
Getwindowmanager (). Getdefaultdisplay (). Getmetrics (Metric);
int
Android system transplantation and debugging -------) how to modify the NFC module of the Android mobile phone so that NFC can be used in the black screen
We all know that, without modifying the source code, NFC can only be used after unlocking. However, NFC cannot be used in two statuses: screen lock and black
This article describes the Android simple Start screen implementation method. Share to everyone for your reference, specific as follows:
After each Android application starts, a splash boot interface appears, showing the product logo, company logo, or developer information. If the application startup time is longer, then the start interface is a good thing to al
In the onreceive that receives the message broadcast, jump to the interface you want to display. Such as:Intent Intent = new Intent (arg0,mainactivity.class); Intent.addflags (Intent.flag_activity_new_task); Arg0.startactivity (Intent);In the OnCreate () method of the activity:Super.oncreate (savedinstancestate); GetWindow (). Addflags (windowmanager.layoutparams.flag_show_when_locked| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); Setcontentview (R.layout.activity_main);Set the theme property
Objective
To achieve the window on the lock screen, the first idea is to WindowManager use Window settings Flag , by setting Flag the display priority to let the window display in the top of the lock screen.
The next step is to experiment with potentially relevant Window Type properties and verify that the scenario is feasible.
Before you try each of the Window Type attributes, you need to specify th
Android screen adaptation and android adaptationI. terms and conceptsFour types of screen sizes: small, normal, large, and xlargeFour density classifications: ldpi (low), mdpi (medium), hdpi (high), and xhdpi (extra high)It should be noted that xhdpi is added from Android 2.
Http://www.cnblogs.com/xiaofeixiang/p/4086092.htmlIn general, there are two ways to run an Android app, one is to set up an Android virtual Device Emulator, to manage it via Android manger, and to plug in a USB cable directly on the real machine, but if the computer is configured to be low, Directly with the real machine and then do the demo when the real machine
In the development of the Android system, there are certain situations that require the system to never lock the screen and never sleep. This article to introduce Android never lock screen, turn on the screen, delete settings in the Sleep time option, need friends to study t
androidmainfest:
Android: smallscreens = "true"
Android: normalscreens = "true"
Android: largescreens = "true"
Android: xlargescreens = "true"
Android: anydensity = "true"/>
If you do not have these lines of code, no matter how you adjust the controls in layout, the phone
This article is not about the form to guide the screen, how to define the information, there are some considerations of the introduction.
This article describes how the guide screen can be better suited to a variety of resolutions, understand that this will help to better define the guide screen, and maintain good communication with designers and engineers.
As
This article illustrates the solution to the black screen of the Android custom camera camera. Share to everyone for your reference, specific as follows:
For some phones, like HTC, when customizing camera, call Camera.parameters's parameters.setpreviewsize (width, height) method when the width and height are odd, There will be a black screen phenomenon, the solu
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.