Samsung Galaxy notes that it does not accept xml file from large layout after updating to Android 4

In my application, I have a small, normal and large layout. Initially, when I buy a Samsung galaxy, it comes with Android 2.3.3, I tested my application in the Samsung Galaxy Note, while it takes a large layout layout and everything works fine.

But as soon as I updated my device to android 4. It started to accept the layout of the layout form - normal, and as a result of this, some changes in my page are aligned. So I want to know why this is happening, is there a way to fix this.

+4
source share
4 answers

I played a little with getResources().getConfiguration(); in onCreate my MainActivity and found out that the device assigns it the smallest width with 400dp, so I took my layout for Galaxy Note in the -sw400dp layout and it worked. The device has Android 4.0.3 installed.

+4
source

The device still reports the same display metrics. The density / width of the screen and the height have not changed. But when you switched to ICS (Android 4), he began to interpret the display metrics as a normal-sized screen, and Gingerbread (Android 2.3) would say that these accurate display metrics are a large-sized screen.

To solve this problem, you need to orientate the Samsung Galaxy Note and other screens that fall into this strange category - create a layout with the name:

 layout-large-port-xhdpi-1280x800 

And put either a large or a regular layout in this resource. This will force your Samsung Galaxy Note to use the layout you like with any version of the OS.

+2
source

Starting with Android 3.2 (API level 13), size groups (layout-small, layout-normal, layout-layout and layout-xlarge) are deprecated, and instead you should use the sw <N> dp configuration specifier to determine the minimum available width required your layout resources. For example, if your layout requires at least 600 dpi of screen width, you should put it in layout-sw600dp /.

Link: http://developer.android.com/guide/practices/screens_support.html

+1
source

You can use layout-sw400dp-land or layout-sw400dp.

Works great with Galaxy Note 1 even with Cianogenmod ROM.

0
source

Source: https://habr.com/ru/post/1415543/


All Articles