how to include a layout for 7 inch tablet? - android

I'm new to android.I have layout-sw600dp/home.xml for tablets, but it does'nt fit to it. It uses home.xml from normal Layout folder.
Please help me to fit the screen to 7 inches tablet.

layout-sw600dp is the right way to do this.
layout-xhdpi has nothing to do with tablets and layout-large is deprecated in favor of layout-sw600dp .
The problem might come from your tablet, is it a bit smaller than 7" ? if you try layout-sw500dp, does it still use the same default file ?

If you want to fit your device (BSNL Penta is701c) try layout-large-mdpi or layout-large-ldpi, because your device have very small resolution (800*480) for 7''.
But normally you should use layout-sw600dp for 7'' devices.

try to add this to your app manifest :
<manifest ... >
<supports-screens android:requiresSmallestWidthDp="600" />
...
</manifest>

Related

How to deal with android multi size screen resolutions?

I made an app , and i am also using layout, layout_large,layout_x large folders for XML.
but when i test my app on 3.7 and 4.7 inch device...they both take XML from normal layout size folder and take layout-large XML for 7 inch tab.
so what should be done for layouts between 3.7 to 5.5 inches??
Help appreciated.
if your min sdk over 13 then try to work with layout-sw600dp... and not with layout-large ..
For example, if your multi-pane tablet layout requires at least 600dp of screen width, you should place it in layout-sw600dp/.
Take a look :
http://developer.android.com/guide/practices/screens_support.html
In addition to layout folder try using density dependent layout.just as we use for drawables.
eg.hdpi,xhdpi,xxhdpi.

Screen Resolution for different Android Devices [duplicate]

This question already has answers here:
Application Skeleton to support multiple screens
(2 answers)
Closed 9 years ago.
How to Solve Screen Resolution Problem?
I want my application run on any android device, and its layout should not change,
I read android Blog of Supporting Multiple Screens,But do not get enough idea.
I have created different layout folder like layout-small,layout-normal,layout-large,layout-xlarge and created different XML files for all folder.
But when i run on Tablet it takes Default normal size XML file,I don't know why?
Please help me to solve it, Thanks in advance and Waiting for response
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true" />
Add this to your manifest file of app.
Create the layout and drawable with following qualifiers
layout-sw600dp drawable-sw600dp
which means tablet screen with minimum of 600dp and higher can use this layout and drawable.
So for standard configuration qualifiers for screen size you can create following configuration:
1)layout-sw480dp drawable-sw480dp
2)layout-sw600dp drawable-sw600dp
3)layout-sw720dp drawable-sw720dp
check http://android-developers.blogspot.in/2011_07_01_archive.html
Following the guide will only help you to deal the problem for the most cases, but never all the scenarios. Check the following list which is the Google's AOSP homescreen source code. Even this cannot guarantee it will work for all the devices. So yours are far from enough.
drawable
drawable-hdpi
drawable-land-hdpi
drawable-land-mdpi
drawable-land-xhdpi
drawable-mdpi
drawable-nodpi
drawable-sw600dp-hdpi
drawable-sw600dp-land-hdpi
drawable-sw600dp-land-mdpi
drawable-sw600dp-mdpi
drawable-sw600dp-nodpi
drawable-sw600dp-xhdpi
drawable-sw720dp-hdpi
drawable-sw720dp-land-hdpi
drawable-sw720dp-land-mdpi
drawable-sw720dp-mdpi
drawable-sw720dp-nodpi
drawable-sw720dp-xhdpi
drawable-xhdpi
layout
layout-land
layout-port
layout-sw600dp-port
layout-sw720dp
layout-sw720dp-port
According to this page the layout-small,layout-normal,layout-large,layout-xlarge
are deprecated and you will use the
36x36 for low-density
48x48 for medium-density
72x72 for high-density
96x96 for extra high-density
as alernative, however for further information please check my answer here

Android multiscreen different layoutfiles for tablets

I have to make an app which runs on 7" tablets with a resolution of 800x480 and also 1024x600.
The most importan tablet of both is the one with 1024x600 so I placed my layout files in a layoutfolder with the name "layout-sw600dp" and it looks good.
The problem now, is that the tablet with 800x480 resolution is also taking the "layout-sw600dp" folder and my layout isn't looking good. So I have to make some changes, but without destroying the layout for the bigger tablet.
Any idea what I can do?
thanks in advance
Frank
ok found a solution. The problem is, that both tablets are in the same android layout group. So I had to modify my layout in this way to fit for both. I had to use more dp settings and scaletype="fitxy" for images, instead of using "wrap_content".

Scaling on android devices beyond 480x800

I have a small Android app which works fine on resolutions up to WVGA (480x800), however beyond this the layouts don't scale (for instance for the Galaxy TAB 1024x600) but appear in the top in the middle (with black borders down sides and at bottom). The layouts look fine in Eclipse at these resolutions.
What Am I doing wrong?
Am I missing something in the manifest? Do I need to supply high resolution resources?
Try putting this in your manifest.
<supports-screens android:xlargeScreens="true" />
http://developer.android.com/guide/topics/manifest/supports-screens-element.html#xlarge
putting
<uses-sdk android:minSdkVersion="4" />
In the correct place in my manifest solved the issue. For some reason I had placed it under <application>.
I've created a tool that allows you to scale/adjust your layouts for tablets and small screen devices and made a blog post about it here: http://onemanmobile.blogspot.com/2012/04/how-to-scale-your-android-layouts-to.html
Basically, defining your layouts in dp units is not enough if you want your app to fit on all devices and tablets, since there's 4 different "density-buckets". The tool will allow your layouts to be converted into fitting these density buckets.
It will also explain in further detail how to make flexible view components.

Android - layout-large folder is been ignored

I have different layout files for
different screens size like
Folder Structure:
layout
layout-large
layout-small
For emulators like HVGA and QVGA there
is no problem, the respective
layout.xml file being refereed. But
the layout-large folder is ignored
when I run the emulator of
WVGA(480x854) , here it is referring
the "layout" folder of the
application. Please point me to the
right direction which is right way to
handle this situation.
I tried using
layout-large-hdpi layout-large-mdpi layout-large-ldpi
layout-normal-hdpi layout-normal-mdpi layout-normal-ldpi
And in the AndroidManifest.xml I
specified
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true" />
but no success
I think the Problem is that people always create a large screen by AVD Manager and it sets the default density to 240 which is not supported by /res/layout-large
If you want to want to test /res/layout-large/any_layout.xml then you should see the density of your virtual device it should be set to 160 not 240 or 120
Make sure the set up emulator's default size is "large" and not "xlarge".
For example if the emulator size is "xlarge", then the "layout-large" folder will be ignored and the default "layout" folder will be used, because it can't find a "layout-xlarge" folder.
This is easy to identify if your using Android Studio.
Have you checked if your API Level is already supporting this? I had this issue as well. In my case I used following line in the manifest, which set the TargetSDK to 4 (1.6), where the support of those different layouts started.
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4" />
Links:
Screen Support

Categories

Resources