Drawable folder for 4:3 devices? - android

I'm developing a game for tablet devices. Currently I'm using drawable-sw600dp and drawable-sw720dp folders to place graphics for 7 and 10 inch devices respectively. But the problem is that the graphics are made according to traditional 16:10 devices which do not scale well on 4:3 devices like nexus 9. I've tried using drawable-sw720dp-notlong, drawable-2048x1536 and a number of different qualifier. Nothing works. If anyone could tell me what folder will work for 4:3 devices without affecting other devices that would be great.

values-sw720dp-notlong
worked very well for me on Nexus-9 (you have typo in word "notlong"), it was prioritized before
values-sw720dp
If it still doesn't work, please check if you don't have other qualifiers with higher priority.
Configuration qualifiers, in order of precedence:
http://developer.android.com/guide/topics/resources/providing-resources.html#table2

Related

What's the correct way to support different tablet sizes?

Our app was originally designed for the Nexus 7 and Nexus 10 (and other devices with wide screens) so we had values-sw600dp and values-sw720dp folders, but with the introduction of the Nexus 9, we need to handle the 4:3 aspect ratio. It automatically uses the values-sw720dp folder since it's 1024x768dp, but nothing looks right since it was originally designed for wider-screens. If I change the values in values-sw720dp it will screw up how the app is displayed on the Nexus 10 and other similar tablets. What should I do?
There are other qualifiers such as long/notlong (or h720dp and so on). See Providing Resources.
Then values-sw720dp-notlong may provide just for Nexus9.
(Or, as a totally alternative solusion, you may use RelativeLayout or LinearLayout for that purpose. This approach reduces needs for switching layouts for different display sizes.)

How many AVDs do I need?

How many AVDs do I need to properly test all layouts? I tried using the stock Google nexus devices but many of the different layouts were tested on the same device. What devices should I use so each layout has an appropriate device? Also, what is the best way to allow flexibility for sp adjustments?
I use:
an avd for the minimum screen I support ~3.5" (320x240 ldpi or 340x480 mdpi)
avds for the most common configuration ~4.5" (480x800 hdpi and 720x1280 xhdpi)
an avd for the maximum configuration ~6" (1920x1080)
include medium and large tablets in the case I also support tablets.
You need exactly four AVD to support all kinds of devices.
You have to set the different screen size for multiple devices esp. hdpi,mdpi,xhdpi and ldpi.
Refer here.You have to create a separate folder for all devices.
Supporting Multiple Screens
Read AndroidDevelopers Training and Guide . You must have at least one AVD for each density type (hdpi,xhdpi etc.). and each with different resolution and physical size.
About the sp- you should define them in dimens.xml file in each values folder(According device width-height).

Android Galaxy S4 uses values-large?

Problem:
I am testing my app using the Eclipse/ADT bundle. On an AVD created to emulate the Galaxy S4 (a device defined as being "normal" in size) the OS is selecting the XML files from the values-large folder.
The Android operating system is ignoring all other values folders I have defined in an attempt to differentiate the S4 from tablets.
Given the following folders, it selects the values-large folder for the S4:
values-large
values-sw720dp
values
values-normal-hdpi
values-normal-mdpi
values-normal-xhdpi
values-normal-xxhdpi
values-normal
The problem is that I have Master/Detail (ListFragment/Detail-Fragment) two-fragment display that only displays correctly on large screens (tablets). It does not display correctly on the S4, because of the device's size. On a device smaller than 6" wide, the icons end up getting displayed on top of the text, instead of to the right of the text. The only difference is with the S4 in landscape orientation.
The S4 is the ONLY normal sized device that can show the two-pane layout in landscape orientation. The Nexus 4 and others cannot. In landscape the extra density of the S4 is what makes it work.
I also don't want the S4 to use the dimens.xml file that is in the values-large directory.
Questions:
Is this normal/expected behavior? Does the OS classify the S4 as a "large" device? The OS has ignored every other folder name I have tried to use to target the S4. So, it prefers the pre 3.2 names over the newer ones.
In other words, when I attempt to use the newer folder names, like values-sw720dp, the OS still chooses the large folder.
I have two AVDs. One I created to match the specs of the S4. The other is the Sony Xperia Z1, that has the same specs and is available when you install the Sony SDK. Both AVDs are setup with size=normal. I have checked each to makes certain there is no mistake in their setup.
Thanks.
EDIT
I have a new LG G2, which is similar to the S4 in size and density. It does NOT use the values-large directory. I think it is using values-normal-xxhdpi, but need to run more tests (changing dimension values in the dimens.xml) to see what directory it is choosing.
values-large etc are deprecated with android 3.2 (?). It was replaced with things like values-sw720dp and there is basically not a single device out there running android 3.0 or 3.1. Any device running android 2.x is most likely a medium sized phone.
This means, there is no need of using this old qualifiers.
values-sw720dp means, smallest width = 720dp I doubt, your S4 is that wide.
You should use a qualifier like values-w720dp, which means width = 720dp where width depends on your current orientation.
It's way better than relaying on port or land combination because it shows the two pane layout for large displays having 720dp width in portrait orientation too.
Master/Detail two-pane layout for large screens (any orientation)
That seems fine. The implication is that you will use this for -xlarge as well as -large.
and medium screens with high dpi in landscape orientation
First, I do not know what "medium screens" are, as that term is not used in Android development.
Second, I have no idea why you think this would be appropriate. Screen density should not impact the decision of whether to show one or two panes. I would be interested to know applications, written by experts, you see taking this approach.
At first I thought it was the second folder (sw720dp) causing the problem
Note that you have not stated what the problem is.
The Sony Xperia Z1 AVD
I am not aware that SONY distributes emulator images for their devices.
does the same thing as the S4 AVD
I am not aware that Samsung distributes emulator images for their devices.
Is there a values folder I can use to make the Galaxy S4 not choose Master/Detail at all, but still allow tablets to use it?
Ignoring your "medium screens with high dpi in landscape orientation", use -large or -xlarge for tablets. The Samsung Galaxy S4 will not use -large or -xlarge resources, as it is a -normal device. This was confirmed using both the GT-I9500 and the SGH-I337 versions of this particular model.
Is there a way I can make it use Master/Detail for the S4 only when in landscape?
You can use -normal-land to identify -normal devices in the -land orientation. Note that screen size (-normal) is a bit of a fuzzy match, in that Android considers that valid for devices in that size class or larger. Hence, -normal-land would be used by -large-land and -xlarge-land devices as well, in the absence of better matches.
(Note that density qualifiers are even fuzzier -- -mdpi will be used for any device density, in the absence of a better match, as density qualifiers are designed to be used only on drawable directories, where Android can apply resampling algorithms. Using density qualifiers on anything other than drawables and maybe dimension resources is a code smell.)
Personally, I would not use a dual-pane strategy for -normal-land devices, as -normal goes all the way down to 3" diagonal.
This is all in the Eclipse/ADT bundle using the emulator.
My guess is that this is where your problems are coming in.
Unless you downloaded something from a device manufacturer (e.g., Amazon with their emulator images for the Kindle Fire series), NEVER say that you have a "Sony Xperia Z1 AVD" or a "S4 AVD". You are lying to us and, worse, you are lying to yourself. At best, you have an emulator image that you think that you have configured to match the specifications of those devices. However:
That assumes you got the configuration correct
That assumes that the device manufacturer has not changed the behavior of their device at the firmware level
That assumes there are no emulator bugs
You are certainly welcome to say that you are testing things on -normal -hdpi emulators, or the like, as those are things that you directly control via the Device Definitions tab of the AVD Manager.
After reading your comments, I noticed you said you said the Galaxy S4 screen size you defined was 4.9"? All the specs I've seen say it's 5" which will actually change the size in Device definitions from "normal" to "large" once you correctly set the S4 and Nexus 5 to 5".
Edit the Galaxy S4 emulator's definitions to 5" so you have the right screen size, it will auto-change the size to large, so you will need to decide if you need to switch it to normal then go from there. Also, for those wondering, once that avd starts, it does say that it's pulling from the sw480dp folder, so in your case, you would need a new folder:
values-sw480dp or to eliminate large devices in this bucket, values-normal-sw480dp

Need to differentiate with 10 inch tabs of different resolutions

I have a requirement in android to support my app in different tablets like google nexus 10 and samsung galxy 10 inch tablet. Nexus 10 is double the resolution of samsung 10 inch tab. I need to place different images for nexus 10 to make my app looks with better clarity for nexus 10 . But both the devices are taking the image from the drawable-xlarge. How can I differentiate between these two devices in drawable level and layout level. Same case is applicable for phones as well where I need to differentiate Samsung galaxy s4 which is double the resolution of xhdpi phones.
-xlarge is a screen size qualifier. Your drawable folders should use screen density qualifiers (-mdpi, -hdpi, -xhdpi, -xxhdpi). If you must, you can use both, e.g -xlarge-hdpi
Don't forget the new smallest width qualifiers. They are of a great help when you need to differentiate based on screen resolution.
I wouldn't consider a non-Nexus tablet anymore, based on how bad manufacturers have been at bothering to update them. The Nexus devices being "Official Google" devices and getting updates from Google means that they're going to be updated for a long while going forward, and once that ends, you can still unlock and root them through a defined process & update things yourself if you care to do so.
I can't think of any 10" Android tablet I'd have other than the Nexus 10. They're really that good.

Designing layouts for phones and tablets

Okay i am familiar with this site and what it says
http://developer.android.com/guide/practices/screens_support.html
But im still having a problem.
I am designing layouts for phones and tablets from gingerbread to jelly bean.
I had started with a basic layout folder and designed everything for a galaxy nexus phone. now im going back and adding tablets. one question here is should i use layout-xlarge/layout-large or layout-sw600dp/layout-sw720dp? im guessing the smallest width is what i should be using.
But thats not the issue.
This issue is im trying to do that layous for Galaxy Nexus (720x1280) and Nexus S (480x800) These are much different yet eclipse doesn't seem to let me differentiate.
So i just want to be clear on what i should be doing to do this right. is this what i should have to cover the devices i want to?
layout-hdpi
layout-xhdpi
layout-sw600dp (instead of layout-large)
layout-sw720dp (instead of layout-xlarge)
will doing those layout-hdpi and layout-xhdpi separate the layouts for a Nexus S and Galaxy Nexus?
First, the layout-sw are based on dp, Density-independent pixels, rather than pixels. You can think of dp as 'actual size' pixels i.e., 1dp is the same physical size no matter what device is being used.
Therefore the Galaxy Nexus, which has a 720x1280 pixel screen is only 360x640 dp resolution and there is no overlap between a phone and the higher sw600+ folders.
The large/xlarge buckets will continue to work on all tablets, but if you need finer grained support or alright only using tablet layouts on Android 3.2+ devices, then you only need the sw--dp folders. You can also use both without copy/pasting your XML by using a reference file, as detailed in the below blog post.
More details on how to support multiple screens can be found in Supporting Multiple Screens guide and some of the reasoning behind why you'd want to use the new sw---dp buckets can be found on the Android Developers blog post announcing the feature.
Just use layout-large and layout-xlarge. When you're developing the layouts and want to know what it looks like on a certain device, just change the view and it will pull the appropriate XML from the correct folder.

Categories

Resources