Where to find large stock Android drawables? - android

Just as the title says. I know there are drawables in android.R.drawables, but because they are so small, they look horrible when scaled up. Does anyone know where I can find the current 4.x drawables that are larger than the ones in the folder?
Since I don't know much about drawables anyways, are the stock drawables in android.R.drawables all in a single size, or are there multiple versions to support different density screens? If so, how can I access these larger drawables?

Does anyone know where I can find the current 4.x drawables that are larger than the ones in the folder?
If you mean larger than the -xhdpi ones, they are probably on some graphic designer's workstation at Google.
are the stock drawables in android.R.drawables all in a single size, or are there multiple versions to support different density screens?
They ship in multiple densities.
If so, how can I access these larger drawables?
They are in your SDK directory, in platforms/$VERSION/data/res/, where $VERSION is one of the available API levels that you have installed.

Related

xxhdpi density added in API 16, what in <16 if I provide only xxhdpi resources?

I'm working on a porting from iOS to Android, and since the iOS guy gave me only #3x versions of all graphic resources, I have placed them only in the res/drawable-xxhdpi folder. I know it's not a good practice to not provide alternative low-res resources, but according to official documentation:
By default, Android scales your bitmap drawables [...] so that they render at the appropriate physical size on each device. For example, if your application provides bitmap drawables only for [...] medium screen density (mdpi), then the system scales them up when on a high-density screen, and scales them down when on a low-density screen.
Now, documentation also says:
xxhdpi: Extra-extra-high-density screens; approximately 480dpi. Added in API Level 16
Then, my question. I don't give any bitmap alternatives aside from xxhdpi, so on devices running Android API <16 will this drawables be rendered at all? I tried the app on an API 10 emulator, and all my stuff is there. Should it be? If yes, why?!?
The answer is yes, your resources will be rendered even on devices with API < 16.
Why yes?
This is just a finding: If you look inside the contents of the output apk res folder. The drawble-xxhdpi resource folder is converted to drawble-xxhdpi-v4
v4 qualifier gets appended with the drawable-xxhdpi folder. The v4 support library was designed to be used with Android 1.6 (API level 4) and this might have a connection that new qualifier resources are detected even on lower API devices.
Qualifiers have been defined to support different resolution devices in a better way. Once you're able to compile your APK with API >= 16 and a lower API device is supported by your app, the resources from new qualifier folders will be picked even on lower API devices if none of the compatible qualifier resources are detected.
Your test on API 10 emulator confirms this.
You should check the best practices, but I understand the question was not about that.
I would really stay away from loading 3x images for lower-resolution devices. Those phones already have limited memory and loading such large images will use up a lot of memory. You should use tools to resize the images for you in all the different densities. Try using this https://github.com/redwarp/9-Patch-Resizer
If you really want to keep one version of the image, put it in the drawable folder (not drawable-xxhdpi). (not recommended because you'll end up with poor looking images on some devices)

Android SDK - selecting correct resources

I built an Android tablet application and I'm trying to figure out how to make the system select the correct resources.
I understand the concepts described in the documentation. There are a number of different resource folders for different densities ldpi, mdpi, hdpi, etc... - but is there a way to have the system select resources based on resolution of the device? In the layout folder structure you can specify minimum width with layout-sw600dp. Is there a similar mechanism for resources? There are several devices considered medium density that have different resolutions. Ideally I would like to define resources for resolutions and have more flexibility than just pixel density.
I've also tried to use the built in scaling but it doesn't appear to work with my Nexus 7. Resources that are designed for higher resolutions do not seem to scale down at all. Perhaps I'm doing something wrong.
Thanks.
I'm not 100% sure I read your question correctly, but you can suffix any subfolder of the res/ folder with the target specifiers. So not just res/layout-sw600dp, but also res/drawable-sw600dp and res/values-sw600dp. These rules can be combined, so res/values-sw600dp-mdpi will also work.
Also note that the Android SDK Documentation is a bit flaky in this area. The Training section explains a neat trick using resource aliases that helps you avoid copy-pasting layout XML's, but the API Guide and Reference docs never mention it, so it's easily overlooked.
you can, you can specialize folder name like this, drawable-800x480, but make sure that greater value will become first(800 in this case)

android resource specifiers - avoiding image duplication

I am making a game for android which uses a large number of images.
I have a set of images that I would like to use for 480x800 ish resolutions (i.e. large devices or normal hdpi/xhdpi devices). Another set of images I should like to use for normal mdpi, normal ldpi and small devices of any dpi.
My problem is this. I could copy the images into many different folders which would give me the desired functionality. However, this would make my .apk too large. I could also create resource aliases using xml. However, with the amount of images, I'm looking at having to create hundreds of xml files manually.
Any ideas on how to accomplish the following more conveniently? I noticed they have introduced new resource specifiers that would solve my problem in API level 13, but I need this to work on android 2.1+
There are resource specifiers in android 2.1+ they were just changed to handle different parameters that better suited android becoming both a tablet and phone platform.
The old specifiers were drawable-hdpi, drawable-mdpi, and drawable-ldpi.
drawable-xhdpi was added to support larger screen sizes in Android 2.2.

Supporting all Android tablets resolutions

The designer of our company wants me to give him the resolutions of Android tablets so he will start designing a new app.
I know there are a lot of different resolutions (listed here: Android Tablets computers).
I also know about the division of Android to the different dpi's (ldpi, mdpi, ...).
My questions :
What should I tell the designer? He obviously not supposed to make a version for each resolution. Besides, some of the resolutions listed in the link above are in the same dpi, so which one should I choose?
Considering the fact the app is going to run only on tablets, what are the dpi classes I should use? Only hdpi and xhdpi? Or should I still use all 4 classes and limit the <supports-screens> tag in the manifest?
Is there a resolution that represent each of the dpi classes that I
should stick to?
I've done some reading about 9-patch. What's the point of using it if I still need to deliver a version for each dpi??
Thanks in advance!
The questions contain so much information.
1 Try to read the article and the references in it.
http://www.androiduipatterns.com/2011/11/design-patterns-for-responsive-android.html
You could also have a look at the web site for android design.
http://developer.android.com/design/index.html
In one word, designing for android tablets is more like designing websites. You cannot just design for one resolution.
2 Considering you are developing for tablets, it's necessary to support mdpi and hdpi. If the apps could be installed on phones, maybe xhdpi is also needed. It's not very strict.
3 dpi(dots per inch) = pixels per inch. So dpi is like density, it do not have strict relationship with resolution. But there is still a sheet could help you, try to find it in the following page
http://developer.android.com/guide/practices/screens_support.html
4 9-patch resource is very useful. With which a small png could stretch to any size without distortion. And it could also help to reduce the size of your resources.
In most situation, you do not have to make 9-patch for each dpi, since it could stretch to any size you want. But if the 9-patch png contain some information itself, like min height and padding, it's necessary to make different versions.
Here is what I would do:
See what combinations you have. There are mostly 3 resolutions for tablets (1280x800, 1024x600, 800x480) and mostly 2 densities (hdpi and mdpi). That is at most 6 versions. Select a few matching your most logical targets (I would choose xlarge mdpi (9" 1280x800), large mdpi (7" 1024x600) and normal-hdpi (4-5" 800x480) and design on these.
Some graphical elements don't need to be designed for each combinations, like backgrounds, may be buttons… Here comes the 9-patch. To be put in drawable-nodpi folder. One resource fits all.
Do one version first on you major target, then see how it fits on the other targets, and consider adjustments from there.
Use ScrollViews if you don't want to position every item pixel-perfectly on each device.

Publishing multiple versions of one app on Google Market

I have an Android app that I would like to display high quality images with. However there are many different screen sizes and ratios. I know there are filters to show apps in Market only for devices with small/medium/large screens.
If I put images of both sizes in 1 app it will double the size of the app, right?
Is it a good practice to make multiple versions for different screen sizes?
I would like to make 1 app in 3 versions for such devices:
medium screen mdpi
medium screen hdpi + large screen mdpi
large (tablets)
If it's possible to do it how can I specify them in manifests? Or is it somewhere in market?
Android has a built-in mechanism for having resources designed for different screen sizes and pixel densities. It's called resource directory qualifiers, and you can read all about it here.
For example, for small screen sizes, you could create a specific layout file and place it in the res/layout-small directory. For a larger screen, you could create a layout file with the same name and place it in the res/layout-large (or res/layout-xlarge) directory.
For pixel density, you could create a small version of your image resources and place them in the res/drawable-ldpi directory (lower pixel densities). And for higher pixel densities, you could create alternate versions and place them in the res/drawable-hdpi directory.
I'd encourage you to read the page on Supporting Multiple Screens, and let Android help you out with its built-in mechanisms. Creating three separate copies of your app is harder for you to maintain, and it confuses potential users (most of whom probably neither know nor care about "pixel densities"). What's to stop them from downloading the wrong version of your app, and getting a lousy experience because of it?
No one seems to be addressing the file size issue you're really asking about, so I'll try.
You should package your high quality images as a set of separate downloads, one for each type of device you plan to support. This makes your base app small, and ensures the end user's disk space is only filled by images it needs.
I've not done this myself, but hopefully the idea will send you on the right search path. I imagine you design the separate download as either resources on your own server, or another set of apps in the market (i.e. "MyApp Image Pack HDPI", "... MDPI", etc.).
As Donut mentions above android has excellent documentation for this here, here, here and here.
Note that all Manifest file changes and how to create one binary that will support different screen sizes, different densities AND different SDK's are at android website. But it requires careful planning and testing to do so.
The best way is to have ALL device configurations (listed here, including the Samsung Galaxy Tab simulater (large screen, hdpi) available here) in your development environment and test your app on them.
You have to create different .apk for each version and define this in your application's manifest file.use this link
http://developer.android.com/guide/practices/screens-distribution.html

Categories

Resources