I have developed an application and created the xml files in different layout :
layout-large
layout-large-1024x600
layout-normal
layout-normal-480x320
layout-normal-640x360
layout-normal-640x480
layout-normal-800x480
layout-small
layout-small-320x240
layout-small-400x240
I have tested the application on five different android devices and it works ok on 4 of it. On the HTC Flyer (resolution 1024x600) the result is not ok. The icon are too little not in the right place...
In the eclipse graphical layout preview of the 1024x600 resolution, the result is ok. I don't understand why the result on the Flyer is not ok.
I have all the image in the drawable-hdpi folder.
Any help would be appreciated !
The problem was that I defined the 600x1024 7.0 display as HDPI instead of MDPI. Now it works OK.
Related
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
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?
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
I am making an android app that displays an image in the main activity. To adjust the size of this image on different screen size devices I made different drawable folders and added images of corresponding resolutions. In android studio the image is perfectly fitting on Nexus 7 device (1200x1920; xhdpi) but is too big for the GalaxyNexus and Nexus 4 which are also xhdpi devices. Why is this so? Can somebody suggest a way to fix this problem? Thanks in advance !!
<ImageView
android:id="#+id/imageView1"
android:src="#drawable/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
I found the fix finally. This can be taken care of using another folder drawable-large-xhdpi for the tablet.
You are correct that a 2013 Nexus 7 and the Nexus 4 are both XHDPI devices. That means that the system will not perform any scaling on the image that you place into the drawable-xhdpi resource directory on either device, but that doesn't mean the image should just be displayed as-is.
The 4.7" # 768x1280px (384x640dp) N4 is not the same as the 7" # 1200x1920px (600x960dp) N7.
Whilst the density resource qualifier generally works well for things like icons, it alone isn't always enough to provide a responsive layout.
What is the image, and how will it be used? Is it a large background image / full screen image?
Just a quick question:
My application should work both for my device (Galaxy Ace - 320 x 480 - "Normal" screen size family) and for the Galaxy Nexus (720 x 1280 - "Normal" screen size family).
I wrote two layouts in two different folders: layout and layout-sw600dp.
Unfortunately the Galaxy Nexus keep to choose the xml definition in the "layout" folder instead of "layout-sw600dp" one.
How can I solve this?
Thank you in advance.
(Thanks to #Class Stacker)
For everyone who has the same issue: put the layout xml file for the Galaxy Nexus in a folder called "layout-xhdpi".