Resource folder for Samsung Galaxy Tab E SM-T561 Tablet - android

Hi I have developed android application for mobile, now we have the application to to Samsung Galaxy Tab E SM-T561 Tablet which is the resolution of 1280*800. Please anyone suggest me the below requirements:
layout folder name.
drawable folder name.
strings values, color and dimen values etc...

Easiest way is to download whats my size app from play store and open it
on Top what ever is seen thats the width of the screen
so you can name the layout as
layout-sw320dp
change the value to what ever is yours
NOTE: if you place a folder name with layout-sw320dp and there is no other folder greater than that value then all screens whose small width is greater than 320 will also pick from this folder
whats ever is xhdpi thats your screen resolution so you can name drawable folder as
drawable-xhdpi
replace xhdpi with your resolution
but i cant see why you neeed seperate string,colours? they will be same for all screens
the values folder can be similar to layout folder like
values-sw320dp

Related

How can we get the drawable subfolder name which is picked by android device

I want to know which drawable sub-folder (hdpi,ldlpi,mdpi,xhdpi,xxhdpi,etc) is used by my application. I have one 10 inch tab which takes resources from xlarge-hdpi folder, but when I tried "Display metrics" it provides 240 dpi i.e "hdpi". I want to know which drawable sub-folder is used by the application in different phones ?
I tried by using Display Metrics but couldn't find the correct drawable folder
https://developer.android.com/reference/android/util/DisplayMetrics

How to set font for diffrent devices

i am creating simple app to show notifications. i want large font on large devices and small fonts on small devices. Please Help.
Following is screen shot of tablet of dpi - 213
Following Screen shot of Moto G3 phone have dpi - 320
You need to create different values folder as per required screen sizes and resolution and put 'dimens.xml' file in each folder.
For example:
For HDPI device- you need to create folder with this name
"values-sw320dp-hdpi" under this folder put "dimens.xml"
For Large HDPI device- you need to create folder with this name
"values-large-hdpi-1024x600" under this folder put "dimens.xml"
For MDPI device- you need to create folder with this name
"values-sw320dp-mdpi" under this folder put "dimens.xml"
Similarlily you can create different values folders for other devices too under "res" folder.
Now, what next to do and How it works:
Say, you have TextView defined in your xml and you need different font sizes on different devices:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/textSize" // This is the important line
android:text="Hello"/>
Now, here 'dimens.xml' file comes into picture. You need to specify different size value of "textSize" under different dimens.xml w.r.t screen sizes and resolution
For Example:
For HDPI device: res>values-sw320dp-hdpi>dimens.xml
<dimen name="textSize">19sp</dimen> // Setting size of Text for HDPI devices
For MDPI device: res>values-sw320dp-mdpi>dimens.xml
<dimen name="textSize">15sp</dimen> // Setting size of Text for MDPI devices
Similarly, you can define sizes for other screen too.
You should use styles, then you can have separate folders "values" (default) "values-hdpi" (high density) "values-mdpi" (medium density) and so on and put your style file with correct textSize values in each folder as needed.
Then, when you are in medium density device it will pick the file in "values-mdpi" folder if exists or in "values" if not, and the same for high density etc...
This same principle applies to al "res" subfolders

Default drawable folder in android

Ok so I have 4 folders in my res directory: drawable-mdpi,drawable-hdpi,drawable-xhdpi,drawable-xxhdpi. I wanted to know how to make a DEFAULT drawable folder where I could place images and if there was no image found in the specific density folders, the android device would look in the defualt one. So I created one with no qualifiers named drawable. The problem is when I put an image in my new created folder, it appeared differently than when I placed it in a specific density drawable folder.. Even though I was using the exact same image. How did changing folders affect my image..?
The default drawable folder will be interpreted as mdpi, essentially. So any image you put in there will be rendered 1:1 on an mdpi device, scaled to 1.5x on hdpi, and scaled to 2x on xhdpi, etc.
All those folders are related to the phone you are using, you can open a default drawable folder named "drawable" but if you want to know, the drawable-mdpi for example is for samsung galaxy tab 10" (and more), you can read more here: http://developer.android.com/guide/practices/screens_support.html

android layout on different screen sizes

i have an application that am trying to implement it on a tablet 7'. this that i have done is the follow. on the folder drawable and layout are my defaults for the normal smartphone screen. also i have create the layout-xlarge and drawable-mdpi in which on the first one i have change the sizes and on the second one i add the images with different size. my problem is that the default get the size of images that i have on the drawable-mdpi folder and not from the default drawable folder. what am i doing wrong? also i have nothing declare on the manifest.
mdpi is the default, so drawable and drawable-mdpi are the same thing and I don't know which Android chooses in this case - but you're designing for a tablet and tablets are generally mdpi devices so it correctly gets it from drawable-mdpi. You could use drawable-xlarge-mdpi if you want separate mdpi resources to be used for extra-large screens. Incidentally, remember a 7" 1024x600 tablet is large, not xlarge - so try drawable-large-mdpi and layout-large-mdpi and see if that gives you what you want.

android-how to differentiate the small screen ldpi and mdpi

I implemented the application which will supports the small screen ldpi and hdpi. It is working for only one either ldpi or hdpi. Because my application layout have some distance between the views. so i want differentiate the ldpi and mdpi. how to implement this can any body help me.
For this i am creating the layout-small folder in the res. is any name conventions like layout-small-ldpi (or) layout-small-mdpi or exiting or not. same like normal and large (layout-normal-ldpi or layout-normal-mdpi or layout-normal-hdpi). Please give the naming convention clearly.
thanks
In your res folder you have 2 folders:
drawable and layout.
You can add folders with a postfix with "-hdpi" for hdpi specifics, "-mdpi" for mdpi and "-ldpi" for ldpi.
So you should have these folders:
drawable-hdpi
drawable-mdpi
drawable-ldpi
layout-hdpi
layout-mdpi
layout-ldpi
You can also use specifics for landscape orientation or even SDK versions.
Read http://developer.android.com/guide/topics/resources/providing-resources.html for more info
To seemlessly support landscape / portrait mode, screen with different densities, you need to put appropriate "drawables" with following naming convention # res directory. res directory will be # root level of you application folder. For example LunarLander\res. res has different directories for storing images (drawables), layaout (for UI) and values (for font support).
You need to use the same name for all modes, this name shall be used in the application regardless of the mode.
Nomenclature is something like . (This may not be the exhaustive list) where type would be drawable / layout / values etc.
language would en / fr for english and french respectively. (this list is also not complete)
mode would be land / port for landscape and portrait respectively
density would be hdpi / mdpi / ldpi for high / medium and low density screen respectively.
Example
Suppose I have a background image, which needs to look differently for landscape and portrait mode. Then I will place two different images for background into res\drawable-land and res\drawable-port\ folder under the name background_image.png. I will refer to these in my application (or layout) using background_image as the name. The android system will appropriate choose the image based on the mode.
Same is applicable to ldpi / hdpi or en / fr.
Basically you need to create appropriate folder structure and keep the same name for entities. (string, drawable, layout etc)
Shash

Categories

Resources