What is Nexus 10 resource directory - android

Please Read the question carefully before marking it as duplicate
I have tried this SO Layout folders for Google Nexus 7 and 10, didn't worked for me.
I am developing an app which should work on both tabs and phones. I've created following resource directories:
layout-mdpi, layout-hpdi, layout-xhdpi, layout-xxhdpi, layout-xxxhdpi, layout-sw600dp, layout-sw600dp-land, layout-sw600dp-land-tvdpi (for nexus 7 land), layout-sw600dp-tvdpi (for nexus 7 portrait), layout-sw800dp, layout-sw800dp-land, layout-sw720dp, layout-sw720dp-land
**same for drawable and values
my problem is that in Nexus 10 it always takes from layout-xxxhdpi (which is certainly not for tab) instead of layout-sw720dp and layout-sw720dp-land.
Is there any way to create a separate folder for nexus 10?
I already have tried these with no result:-
layout-sw720dp-land-xhdpi
layout-sw720dp-xxhdpi

Possible solution is to go by screen size - layout-large and/or layout-xlarge.
Once I developed for highres tablets (10"), I had to go with layout-large.
Also you pretty much don't that number of directories, research about RelativeLayout, wrap_content, match_parent and density pixels

Related

Configuration qualifers - Multiple screen size

I'm creating an application for smartphone tablet and televison.
I'm creating my different displays, but I can not differentiate the tablet from the television.
I read https://developer.android.com/guide/practices/screens_support.html
I have tried many things, large,xlarge sw720dp, W1024dp.. but nothings works. I work with the emulator.
AndroidTv 1080p API 25, Résolution 1920*1080:xhdpi
Nexus 5 API 24 Résolution 1080*1920:xxhdpi
Nexus 7 1200*1920 xhdpi
Thanks for your help !
The documentation you want is here: https://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources
The important parts of this page are Table 2 (configuration qualifier names) and the section titled How Android Finds the Best-matching Resource.
Reading these, it is clear that you will use the Smallest width qualifier to differentiate between phone and tablet devices, and the UI mode to differentiate between televisions and non-televisions. This directory structure should work:
res/
layout/
layout.xml (default (i.e. phones))
layout-sw600dp/
layout.xml (non-televisions 600dp or wider (i.e. tablets))
layout-sw600dp-television/
layout.xml (televisions 600dp or wider)
Because the Smallest width qualifier has a higher precedence than the UI mode qualifier, if you tried to just use layout-television you would find that your TV still used the -sw600dp layout.

Layout issue with Micromax Fun book (Size qualifiers confusion)

I have the following structure of layouts for a particular activity:
Now when I check the specs of Micromax Funbook over here I get to know it is a 7 inch tab with resolution of 400X800
The docs state that for seven inches tablest I should use sw-600dp qualifier. However I am puzzled as the concerend tablet is taking layouts from sw-480dp folder.
When I test on a Nexus 5 device which is 4.95 inches and thus should either refer to sw-480 or sw-600 I see it takes the layout from layout folder without any size qualifier(mock_layout.xml - without qualifiers)
What could be wrong? What is the proper way of doing this?

Choosing layout folder for supporting all devices

I got a problem related to the layout folder for some device.
So at first I had layout and layout-large folder. I only have 3 xml files for layout inside of these layouts.
layout folder has xml files with using Eclipse configuration of Galaxy Nexus 4.65" (720x1280 xhdpi)
layout-large folder has xml files using Eclipse configuration of 5.1" WVGA (800x480 mdpi)
I tested it on a small Samsung Galaxy Youth 3.3" (320x480), and it's using layout folder... I don't really understand about screen res, I read it in google doc but until now I don't really get enough of it. Google Nexus configuration looked fit for small screen so I chose it without enough understanding in resolution or screen size. Somehow, it fit well in my Galaxy Youth.
While for larger screen device I depend on layout-large folder, so I tested it with Galaxy Tab 7". It fit well too.
Problem arise when I tested it with Galaxy Note 2 and Galaxy Note 4 .. (for other devices I didn't test because I don't have them).
Galaxy Note 2 and Galaxy Note 4 seems to use layout folder not the large one (I'm sure it'll fit well in my layout-large).
I actually want 320x480 or smaller screen size devices to all use layout and any devices with larger screen should use layout-large. How to achieve that?
YOU CAN USE CODE TO SELECT YOUR DESIRED layout for specific smallest-WIDTH of DEVICE..IN
onCreate:
Configuration config = getResources().getConfiguration();
if (config.smallestScreenWidthDp >= 480) {
setContentView(R.layout.main_activity_LARGE);
} else {
setContentView(R.layout.main_activity);
}
the Document say about ( sw NUMBER dp) format :" The exact point of this switch will depend on your particular design—maybe you need a 720dp width for your tablet layout, maybe 600dp is enough, or 480dp, or some number between these. "
so you can put in res :
res/layout/main_activity.xml
res/layout-sw480dp/main_activity.xml
Look here: http://stefan222devel.blogspot.sk/2012/10/android-screen-densities-sizes.html
There is more information about screen sizes and densities of android devices

Layout folder to support different devices screens

By following this tutorial, I created 3 different layout folders (over default layout folder):
layout-large
layout-small
layout-xlarge
In this way, some screens do not fit as I want.
For example, Nexus s, Galaxy Nexus and Nexus 4 preview seem to use the default layout, but it doesn't fit well.
Should I create other layout folders, for these devices (and others that I'm maybe forgetting)?
Nexus s, Galaxy Nexus and Nexus 4 are all "normal" sized devices (or large, i'm not sure). So the behaviour you're getting is "correct".
Have you tried to specify layouts according to the smallest width?
Something like layout-sw480dp, this should target the devices you want.

Different InfoWidget.xml for App Widget

i have a question about the app widget in android. I'm a litte bit confused, cause i define in the info xml (res -> xml) the values for width (250) and height (110) (http://developer.android.com/guide/practices/ui_guidelines/widget_design.html). Now i expected my Widget take the in the width 4 cells and in the height 2 cells.
I tested it with a Nexus S (HDPI), all works fine, i tested it with a Nexus 4 (XHDPI), all works fine, i tested it with an Samsung Galaxy Tab 10.1/Emulator tablets (MDPI), it doesn't work, Nexus7 (Emulator) (TVDPI) also it didn't work.
OK, I looked in the Menu and i see the system takes 3 and not 4 cells for the width.
Now my Question is there a way to define specific xml files for the tablets (please notice that i would support device with android 2.3.3) or am I missing something?
Have you tried putting your layout for the widgets into different folders, so that it will be rendered out differently on different screen sizes? For example, when supporting tablets you would have a layout-xlarge folder which contains the layout for your Widget on extra large screens. See here for more information about Tablet layouts.

Categories

Resources