I want to deploy my application on different screen sizes using the 1.6 feature.
I exported the drawable resources with different resolutions in drawable-ldpi, drawable-mdpi and drawable-hdpi folders.
On android 1.6 and 2.0 everything looks good.
My problem is that on 1.5 the drawable-ldpi resources are used instead of drawable or drawable-mdpi ... the application still works but it renders the images scaled and the image quality is lost.
How can I configure the application so that on 1.5 the only the drawable-mdi folder will be used?
I'd like to keep the apilevel to 3 so that the same apk will run on 1.5, 1.6 and 2.0.
Try adding -v4 to your -ldpi, -mdpi, and -hdpi directory names, and having a base res/drawable/ for use by Android 1.5.
Related
So I was pasting some image in the drawable folder and I found that there are 2 folders as you can see in below picture
one is drawable and another is drawable-v24
So my questions are
why there are 2 drawable folders ?
whats the diff. ?
Do we really need them ?
any additional information is deeply appreciated . :)
The drawable folder is the default folder. The drawable-v24 applies to only those devices with Android v24 or higher- any file in that directory will be used instead of the file with the same name in drawable on the applicable versions. Do you need them both? Only if you want different images on newer devices, or if there's some feature of v24 and higher that you want to take advantage of where available. If not you can safely delete it.
There are many drawable folder types based on many factors,
Android OS version, ex: drawable-V21, drawable-V22, drawable-v23...etc
Density pixels - Refer https://developer.android.com/training/multiscreen/screendensities
This different folder types are used to access the images for particular needs, say if you have to load a small size icon in Lollipop OS and a different size icon in all other OS, you have to use drawable-V21 for lollipop and normal drawable folder for all others.
Another case based on the resolution of mobile phones, quality will vary on images, example: drawable-hdpi images supports Full HD mobiles, whereas drawable-xxhdpi support QuadHD mobiles and so on..
android studio 3.6
In android app I use one image with different dimensions. I put image in the next folders:
drawable-hdpi, drawable-mdpi, drawable-xhdpi, drawable-xxhdpi, drawable-xxxhdpi
Nice. It's work fine.
Now what about flutter app. Is I also need to create different folders for every image's dimension?
P.S. I need this image for android and iOS version
As mentioned in the Declaring resolution-aware image assets. You can create folders based on the resolution and add images to it.
The main asset is assumed to correspond to a resolution of 1.0. For
example, consider the following asset layout for an image named
my_icon.png:
.../my_icon.png
.../2.0x/my_icon.png
.../3.0x/my_icon.png
On devices with a device pixel ratio of 1.8, the asset
.../2.0x/my_icon.png would be chosen. For a device pixel ratio of 2.7,
the asset .../3.0x/my_icon.png would be chosen.
Reference Assets and Images
For an Android App created using Flutter, You can still use these folders as shown below for varying screen densities
Hey all, right now I have a drawable-hdpi, drawable-mdpi, drawable-ldpi folder inside my res directory... I hear that android now filters out applications based on screen size and density. All of my images are inside the drawable-hdpi folder. Should I make just 1 folder called "drawable" and delete the other 3? Or should I convert all the images to the proper size and place them inside all three folders?
Leave the folders as they are and put your medium density images in drawable-mdpi and hign density images in drawable-hdpi folder. I would leave the small density screens and let android scale them. But if you are worried about small density then put those in the drawable-ldpi directory too.
There are only a very few devices that support small screens.
Now for supporting multiple screens you need to make some changes in your manifest. Here is the explanation of what developers need to do to support multiple screens.
A note of caution if you are supporting 1.5 devices. In this case put all the images in your drawable-mdpi into drawable folder. That is because 1.5 devices do not support multiple screens and they recognize images in drawable folder.
My project contains three drawable's folders: drawable-hdpi, drawable-mdpi and drawable. I build it with android:minSdkVersion="3". When it runs on Andriod 1.6 or higher it always uses images from drawable-mdpi on high density screens.
How to fix this?
Have you tried setting android:anyDensity="true"?
http://developer.android.com/guide/topics/manifest/supports-screens-element.html
On the topic of included standard icons the Android documentation mentions that:
Shown below are standard menu icons
that are used in the Android system.
Because these resources can change
between platform versions, you should
not reference the system's copy of the
resources. If you want use any icons
or other internal drawable resources,
you should store a local copy of those
icons or drawables in your application
resources, then reference the local
copy from your application code. In
that way, you can maintain control
over the appearance of your icons,
even if the system's copy changes.
Note that the list below is not
intended to be complete.
In my application I'm using such standard icons such as "ic_menu_sort_alphabetically" and thus I've tried to find these icons, so that I can include them in my application.
However, in "android-sdk/platforms/android-8/android.jar" I only find the icons in drawable-mdpi and in drawable-hdpi - there is neither a default drawable folder with icons, nor a drawable-ldpi folder with low-resolution versions of these icons. However, such a low-resolution version would be required to provide native versions on ldpi devices such as the HTC Wildfire.
Are there any "official" versions of the Android icons scaled at ldpi? While it's likely that the ldpi versions are stored somewhere on my HTC Wildfire device, I assume that they are copyrighted by HTC and not under the same open-source license as the icons in the Android distribution.
If you can't find the pre-scaled images, you can just open the mdpi in Photoshop or GIMP and resize them by 75% to make the ldpi icons. To make hdpi resize the mdpi image by 150%.