I want to create a dashboard screen for my Android Native app, the Dashboard will have 9 ImageButtons but i am having difficulties on the size ratios for the Images in my drawable folders so that my Dashboard will be compatible on all (most) devices.
I want the 9 Image Buttons to fill the whole dahsboard with allowance being given to spaces between the buttons
Please can you give me an indication as to the sizes for my images and which drawable folders i need to place them in
Iconography is the first place to look for regarding the icon sizes. The sizes and folders as per the documentation is as follows. Note that it is for icons like actionbar icons like search. For homescreen type icons you need to magnify as per your need.
drawable-ldpi not required
drawable-mdpi 48x48 px this is the base other resolution are factor of this base
drawable-hdpi 72x72 px 1.5 times base
drawable-xhdpi 108x108 px 2 times base
drawable-xxhdpi 144x144 px 3 times base
drawable-xxxhpi 192x192 px 4 times base
Also note that images will have padding associated with it and usually have transparent background. Also for people looking for official android icons here's the download link.
Related
I offer the ability to change the app icon via a setting... I'm thinking about adding app icons in all material colors (500 + 900 values) which results in 34 icons + 2 for black and white.
Now I'm thinking of adding them only in a few resolutions instead of all. Which one can I safely remove?
I would add:
mdpi
hdpi
xhdpi
xxhdpi
xxxhdpi
Would it work if I only add xxxhpi icons? Or xxxhdpi + hdpi? Which sizes are necessary so that it always works?
EDIT
Why do I want to do this? Just to keep my app as small as possible but having nice icons for all devices
its best to have images in all size of same name,it will take the image based on the resolution of the device
As a general rule, when storing image resources for use in an Android project, should they be placed in the res/drawable or the res/mipmap folder?
Apologies for the simple question, I'm relatively new to Android development. The IDE I'm using is Android Studio 1.0.
My rule is that if an image will have noticeable changes in quality when they are scaled up or down depending on the android device should be stored in mipmap folders. Examples of such images would be icons, slider bar scrubbers or custom google map markers. Images that don't get affected by changes in scale can be put in the drawable res folder.
The graphic resources are stored in corresponding folders “drawable”. A store application icons are stored in the folders “mipmap”. To make the icon you have to make the files with the identical name which will be differ by resolution only and will be placed in the correspondent folders “mipmap”. Here are the the dimensions in pixels for each screen density:
LDPI 36×36.
MDPI 48×48.
TVDPI 64×64.
HDPI 72×72.
XHDPI 96×96.
XXHDPI 144×144.
XXXHDPI 192×192.
When the screen density is not important, I create a simple “drawable” folder and I store there all images. If the screen density is important it is possible to calculate the dimensions of the image, based on the ratio of the size of the base image to the appropriate screen ratio. For the base density is taken MDPI (48 × 48):
LDPI — MDPIx0.75.
HDPI — MDPIx1.5.
TVDPI — MDPIx1.33.
XHDPI — MDPIx2.
XXHDPI — MDPIx3.
XXXHDPI — MDPIx4.
At the time of publication in the convenience store (play.google.com), you will need also 512 × 512 icon and picture for advertisment of 1024 × 500.
In the manifest, do not forget to register R.mipmap.your_icon_name (default R.mipmap.ic_launcher) and the system will automatically select the icon under the screen density
Images that don't get affected by changes in scale can be put in the drawable folder.
If you are building different versions of your app for different densities, you should know about the “mipmap” resource directory. This is exactly like “drawable” resources, except it does not participate in density stripping when creating different apk targets.
Provide at least an xxxhdpi app icon because devices can display large app icons on the launcher.
It’s best practice to place your app icons in mipmap- folders (not the drawable- folders) because they are used at resolutions different from the device’s current density.
I'm new to android programming and every single somewhat-similar question is from three or so years ago and doesn't really answer my question. Android Studio used to have different drawable folders for different dpi. Now there is only one. So if I have two images with the same name but for different dpi, where do I add them so that during runtime the phone can use the appropriate image?
Also, most android phones now are xhdpi or xxhdpi--do I really need to include any images less than that? And how exactly would I do that? Say, for example, that I get an image off shutterstock. How do I make it so it works correctly for both xhdpi and xxhdpi?
Those folders have not gone anywhere, if you want them you simply create a new folder and name it appropriately ( drawable-xxhdpi etc.. )
Depending on IDE it just does not make them by default under certain circumstances
DENSITY SIZE LOCATION RATIO SCREEN MARGIN
XXXHDPI 192×192 drawable-xxxhdpi 4 640 DPI 12 to 16 pixels
XXHDPI 144×144 drawable-xxhdpi 3 480 DPI 8 to 12 pixels
XHDPI 96×96 drawable-xhdpi 2 320 DPI 6 to 8 pixels
HDPI 72×72 drawable-hdpi 1.5 240 DPI 4 to 6 pixels
MDPI 48×48 drawable-mdpi 1 160 DPI 3 to 4 pixels
MDPI 48×48 drawable (Cupcake) 1 160 DPI 3 to 4 pixels
LDPI 36×36 drawable-ldpi 0.75 120 DPI 2 to 3 pixels
NA 512×512 Google Play NA NA As required
Android Studio used to have different drawable folders for different dpi.
It still does.
Now there is only one.
No, there are several. However, in the "Android" project view, they are shown in a collapsed state:
If you change the drop-down towards the top-left of that screenshot to "Project", you will get the view that you are used to, that mirrors the filesystem:
So if I have two images with the same name but for different dpi, where do I add them so that during runtime the phone can use the appropriate image?
The same place as before. Personally, I find the "Android" project view to be singularly useless, and so I switch to the "Project" view as one of the first things when I open the project.
most android phones now are xhdpi or xxhdpi
No, right now, only about a third are.
do I really need to include any images less than that?
I would. If you have a zillion drawables, you are welcome to experiment with having fewer densities, but you will want to test the lower densities to confirm that the downsampling of your drawables is turning out OK.
Create the folders yourself as you need them. It's true that most phones now are xhdpi but what about your target audience? Are you sure their phones and tablets support xhdpi at minimum? There are some tablets such as the Galaxy Tab 2 which are below these values. Just something to keep in mind. Although, consider using layout-sw(x)dp for devices bigger than 600dpi
You'll have to resize them for the appropriate drawable. Use you should follow the 3:4:6:8:12:16 scaling ratio where 48x48 is the baseline. As an example, in order to support xxxhdpi your drawables would be 192x192
Actually Android Studio also has multiple drawable folders. But It remains wrapped in Project Structure's Android View.
So you see only one Drawable folder.
If you want to see all the drawable folders in expand mode then click on the drop down like below and select "Project":
Now you can navigate the drawable folders like this:
What sizes should the image be for each phone size (HDPI, MDPI, XHDPI, XXHDPI) in the navigation drawer like this one?
It should be 24dp. Refer image from material design specification for navigation drawer.
For entire specification of navigation drawer check out this link http://www.google.com/design/spec/patterns/navigation-drawer.html
According to the Google I/O 2015 App source code, it should be 40dp
You can check it here:
https://github.com/google/iosched/blob/master/android/src/main/res/layout/navdrawer.xml
Lines 72 and 73. You will see:
android:layout_width="#dimen/navdrawer_profile_image_size"
android:layout_height="#dimen/navdrawer_profile_image_size"
And, in the dimens.xml file (https://github.com/google/iosched/blob/master/android/src/main/res/values/dimens.xml), in line 136, you will be able to check that the dimen value is:
<dimen name="navdrawer_profile_image_size">40dp</dimen>
I personally found it the perfect size. It's the same used in the Gmail App, if I'm not wrong.
Edit:
I've tried and didn't achieved to get the same size than the Google I/O App, even using their exact dimen variables.
So I've created and measured the sizes, following the rules of the Google specs (https://www.google.com/design/spec/patterns/navigation-drawer.html#navigation-drawer-specs) and I achieved this which looks quite similar to Gmail and Google I/O Apps:
Hope this helps,
If you are designing in Photoshop or something similar and you need to work in pixels, the ratio of the navigation drawer image should be 16:9
In xxxhdpi folder it should be 1216 x 688 (pixels)
You might want to have your icons auto-generated (to give you the right sizes).
See Android Asset Studio.
Just select an ICON that you want from their collection (or UPLOAD one of your own), and choose the parameters (colors, etc) to match your project, and download..
You'll probably want this flavor of icons: Action bar and tab icons
The size should be based on device size for that use below icon sizes.
mdpi : 24 x 24 px
hdpi : 36 x 36 px
xhdpi : 48 x 48 px
it will fit based on device size.
I have created four versions of my launcher icon for ldpi, mdpi, hdpi and xhdpi devices. They are of dimensions 36x36, 48x48, 72x72 and 96x96.
I'm wondering what will happen when using a large screen. Consdering large screens are rouglhy 7" + in size a ldpi, large screen will surely not want a 32x32 icon image, located in a drawable-ldpi folder.
I cannot find anything on the dev guide that indicates what icon sizes to assign to large and xlarge devices. Presumably I would put a larger copy of the icon in the drawable-large and drawable-xlarge folder. However, I do not know what sizes to use. Does anyone have any recommendations?
Google provide an online tool called Android Assest Studio which creates the launcher icons in the correct size for you. http://android-ui-utils.googlecode.com/hg/asset-studio/dist/icons-launcher.html
A 7-10" tablet doesn't need anything unusually large. You don't need anything bigger than a 96x96 launcher icon for this use case. There is a table in the Launcher Icons section of the design docs that shows which sizes correspond to which densities.
Have a look at the Declaring Tablet Layouts section of the design docs for more info on how to organize resources for 7-10" screens. (Note that the resource used will depend on the screen density, it is possible that a 7" tablet will have an mdpi screen.)