<span id="Label3"></p><p align="left"><p align="left"><span style="font-size: large;"><strong>Different phone resolution adaptation issues in Android</strong></span></p></p><p><p><span style="font-size: small;">In the development of the project, the same layout corresponding to the different phones will show different effects. the <strong>reason for this phenomenon is that different phones have different resolutions. </strong>in the help document provided by the Android sdk, we can see the resolution of various phones and the corresponding screen size. QVGA (240x320), WQVGA400 (240x400), WQVGA432 (240x432), HVGA (320x480), WVGA800 (480x800), WVGA854 (480x854).</span></p></p><p><p><span style="font-size: small;">The current resolution of the Android phone is roughly what is described in the Help Document. <strong>There are two ways to adapt a different phone. One is in Java code, and the other is in an XML file. </strong>the specific use of which method is more effective and appropriate, depends on the specific circumstances.</span></p></p><p><p><span style="font-size: small;">In previous projects, I had previously done a history chat record, showing the number of matches per Page. Different phones, each page can show the history of the number of bars is Different. I'm using a match in Java Code. <strong>different resolutions of the phone, they all have fixed screen height. </strong>for example, 480x800, screen height is 800. 240x320, the screen height is 320. <strong>depending on the height of the screen, a limit is given for the number of entries for each page showing history. </strong>I personally think that <strong>in the Java code to do phone matching, to see the matching layout, the control is too many, not too many, can be changed in the Java code according to different circumstances</strong> , otherwise, the Java code will appear very verbose, the change is also very cumbersome.</span></p></p><p><p><span style="font-size: small;"><strong>mobile phone matching in xml, mainly for the layout of the control too much, inconvenient in the Java code to modify the Situation. </strong>in the XML to solve the mismatch problem is very simple, <strong>for different phone resolution, the corresponding layout file can be Established. </strong>for example: 480x800, establish layout-800x400,240x320 between, establish layout-320x240. Special note: Large write in front, for example 800,320, small write in the back, for example 480,240. <strong>after you have set up the layout, adjust the size and position of the controls on the different Phones. </strong></span></p></p><p><p><span style="font-size: small;">In this project, I am responsible for different phone views of the matching problem, I chose the XML matching method, the results found by the above way, the corresponding resolution of the phone display has no effect, later, I look at the help document, It is found that the following code must be configured in Androidmainfest:</span></p></p><p><p><span style="font-size: small;"><supports-screens<br>android:smallscreens= "true"<br>android:normalscreens= "true"<br>android:largescreens= "true"<br>android:xlargescreens= "true"<br>android:anydensity= "true"/></span></p></p><p><p><span style="font-size: small;"><strong>without these lines of code, no matter how you adjust the controls in layout, the phone with the corresponding resolution has no effect. </strong>note: due to the different Android version, some versions do not support xlargescreens, you can directly remove the android:xlargescreens= "true".</span></p></p><p><p><span style="font-size: small;">source:</span> <span style="font-size: small;">http://blog.csdn.net/lgl125/article/details/7558179</span></p></p><p><p>Android Learning nine: Screen Adaptive</p></p></span>
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.