Android layout folders - java

Hi I'm developing an android application and I'm having trouble with the layout on nexus phones and tablets as they are very high resolution. I don't know which layout folder would be applicable to best match nexus 5, nexus 7, etc as they both have different screen sizes but very similar resolution. Can anyone give opinion to achieve this? I know probably I'll be needing different folders for the different phones (nexus 5 and nexus 7 to name a couple) but can't figure out the best ones to use. Thanks

Here are some numbers for typical screen widths:
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).
Refer guide
And also:
For nexus 7
layout-large-hdpi
For nexus 10
layout-xlarge-xhdpi

I think you can use folder : layout-normal-land for landscape and layout-normal-port for portrait.

Its all here, if you just read the whole article it'll fixe your problem, ive been dealing with this before and this article helped me. Hope it helps you.

Related

Background/UI for multiple devices

I’m new to Android programming and I’m stuck with a very specific problem. I want my application to run on multiple screen sizes and densities.
I have several real devices with different screen resolutions (Samsung Galaxy S7 Edge [xxxhdpi], Samsung Galaxy A5(6) [xxhdpi], Samsung Galaxy Note 10.1 tablet [xhdpi].
I made one background and scaled it down for every generalized density. I saved the files as “background.png” in separate folders like suggested in Supporting Multiple Screens.
After testing the APK on the devices, everything worked fine except the background on the S7. It will always load the next lower resolution bitmap (xxhdpi instead of xxxhdpi). I looked countless threads how to fix this problem but nothing worked so far.
The resolutions of my bitmaps are:
drawable-mdpi //320x480
drawable-hdpi //480x800
drawable-xhdpi //720x1280
drawable-xxhdpi //1080X1920
drawable-xxxhdpi //1440X2560
I hope that someone can help me on this one. I’m really losing my mind.
This is a little complex but I'll try to keep it simple. The android system chooses the right resources based on a lot of factors (which you can see when you create a new resource file under the "Available qualifiers" list) which you can group to create a resource shared by different configurations or use only one of them to specify one particular configuration. But you cannot control witch resource the device will use for the most part (there are some you can specify yourself ex: night mode). Your S7 probably uses the wrong resource because probably one of the settings for the display resolution is set at a lower setting (ex: battery saving modes lower resolution, gaming mode.. etc, accessibility settings). And if you want a tablet to use a different drawable then a phone then you should use the "smallest screen width" qualifier since you can specify different screen sizes in Dip(ex: sw320dp is a normal phone, sw440dp is a big pixel phone, sw720dp is a medium tablet and sw1048dp is a bigger tablet). Read more here
I'm also facing like this. My app only works on high resolution mobile only. Then I found that error. I placed my drawable on drawable-hdpi only . For every assets we have to place default drawable in drawable folder
put default drawable in that folder.
drawable
For handling images on the s7 device we can give height and width to the image view. Set the values for height and width from the dimens file. For handling s7 UI need to add the dimens-sw411 file and specify the height and width in that.

Android studio - Different device is using the same layout, but everything looks good only on one of them

I have 4 sets of layout xml and corresponding drawbles, including hdpi, tvdpi, xhdpi, and xxhdpi
I have 2 phones to test the app on, one is a virtual Nexus 5x, another one is a physical Galaxy Note 4
The xml layout works out perfectly on the Nexus 5x, but since (I assume) Note 4 has a smaller resolution / different ratio, the content is overlapping a little bit on it.
This app is very different than regular ones since it has a lot of image views in a relative layout arranged in a specific pattern. Problem is that the system is using xxhdpi resource and layout on both of the device. How do I fix it in a situation like this?
Thanks!
I faced the same problem few days ago.Use dimen.xml which is lacated under values folder.Make folder like values-sw600dp and make dimen.xml under this. Define all the relations in there and call it using #dimen/....
Android automatically will choose best match for your device.

Layout problems on Samsung Galaxy Y S5360

I am new to Android Development. I have recently developed an app that supports Screen sizes of 3" to 4"! The problem is that When I run my app on my HTC Wildfire S (3.2") it works find the screen visuals are fine to see and it gives best resolution.
But when I run the same app on my Samsung Galaxy Y S5360 (3") a small portion of the screen vanishes at the spot I mean the screen visuals are not so much visible to see and gives bad visuals of screen.
Why it is so when I have set the screen size as ranging from 3" to 4". I am using Relative Layout and in the Eclipse IDE the Screen is showing so well also.
HERE is the Eclipse IDE image
HERE is my Samsung Galaxy Y S5360 Image: sorry for poor image.
YOU can see the problem of text at the bottom of cell phone image how can i fix this? please help thanks in advance!
First- never trust the eclipse plugin. Its buggy, and its an estimation anyway. You can use it to see if you're roughly right, but never expect it to look like that ont he actual device, much less on all devices.
As for your problem- the screen on your device is too small for your layout. You either need to cut out whitespace or shrink something. If you can find out the exact resolution of this device you could make a special layout for devices of that resolution.
This is a standard problem in android UI design- you're developing for a lot of screen, some of which are very small. If you want it to work on everything, you have to be very careful with the amount of content and empty space on each screen and test against a variety of resolutions and physical sizes.
A good way to get around this is to size everything in dp. 1dp=1/160th of an inch. Then you know how big a screen you'll show on.
My 2 suggestions are as below
1.Can you try using scroll view for your content
2. apply full screen to your app & change the current layout of the app(if in case of linear layout)

Issues on Android Screen Sizes

I am still trying to figure out a solution for this. Ive created a multiple layout on my res folder namely: layout, layout-sw480dp, layout-sw600dp, layout-sw720dp. Now testing it to real device which is (Samsung galaxy (7 inches) and Alcatel T10(7 inches)) they both go to layout-sw600dp but samsung seems much bigger than alcatel. Most of 7 inches tablet works fine except Samsung. Ive read this link Screen sizes and found out that
The original Samsung Galaxy Tab is an interesting case. Physically it is a 1024x600 7” screen and thus classified as “large”. However the device configures its screen as hdpi, which means after applying the appropriate ⅔ scaling factor the actual space on the screen is 682dp x 400dp. This actually moves it out of the “large” bucket and into a “normal” screen size. The Tab actually reports that it is “large”; this was a mistake in the framework’s computation of the size for that device that we made. Today no devices should ship like this.
My Samsung galaxy is 3.2 so I am sure that it fits on my requirements.
Does someone know how to handle this kind of problem?Like can I create a new folder for Samsung Galaxy only?
Sorry for my english, it is not my native language.
I struggled with the above issue for sometime and found that thr was no alternative for this in xml.
You must handle this during run-time, if you only want it for this specific model then u can get the model make during runtime here and then handle the scenario.
I dont see anyway u can have a special folder for samsung, if you find out,please do let me know :)

UI for Android - What resolution to design for?

I'd like my app to work on phones (320x480 usually) and tablets (840x600, 800x600 and 1024x600).
I'm not sure which resolution to design for and how it would scale on various devices. Can anyone please suggest what resolution and dpi should I use?
Discussing this with Tim Bray in a conference he said:
You should design for the biggest resolution and the higher dpi and then scale to the smaller ones.
Right now I think that tablet version requieres a different layout with different UX. For instance I would try using Fragments on the tablet version of my app.
Have a look at this resource:
Supporting Multiple Screens
Android handles different screen resolutions automatically in that you specify sizes in "dip" (device independent pixels) and by providing different drawable folders (drawable-hdpi, drawable-mdpi, drawable-ldpi) where drawables are fetched depending on the resolution capabilities of the device your app is running on.
If you want to target tablets specifically, then I'd start coding for the Honeycomb system. Devices will be available soon ;) The SDK is already available on the developer.android.com site.
Recently i developed a android app its in the market by name Starrpartners in this i use the design of 320x480 as a target and putting the images in mdpi folder. it worked pretty well on higher resolution as well .
You can check it by making your app and running it on different resolution simulator .
Hope it helps :)

Categories

Resources