I've been trying to create an image button to use in my test app. Once I've imported the asset it looks grainy and pixelated, especially compared to the app_compat radio button. Here is the comparison (custom asset on left).
How can I get the edges of my custom asset to be as clean as the radio button?
You need to provide assets for various screen densities. If your app is not providing such assets directly, then Android will try to make such by usually scalling what your app provides. This usually ends with pixelated graphics. Please read this article about how all this work in Android: https://developer.android.com/guide/practices/screens_support.html
Related
Android comes with many built-in drawables that are listed on this page. Is there any page where one can see what each of these drawables looks like?
E.g., we need to display a green check and red cross depending upon whether a web request succeeded or not. We would like to see if there is any built-in drawable we could use for this instead of creating our own drawables. But the web page linked does not show how the drawables look like so we don't know if there is a built-in drawable that works for us.
Is no such web page exists, does anyone know how one can iterate over the built-in collection of drawables? Then, we could try writing a program ourselves to do the visualization.
I'm not sure that I understand your question correctly, but if you are using Android Studio, try right clicking the resource folder -> New -> Image Asset and then choosing one of the icons. It gives you a preview of what the icons look like.
Here is an app to visualize the built in icons in a photo gallery. It lets you quickly browse the built in icons and search what you are looking for.
I'm working on creating an Android application based on an already created iPhone app. I have a bunch of app icons from the iPhone application that end in '#xx.png' (x being a number).
I know this has something to do with the resolution of the image, but do I have to do anything regarding converting them into vectors/renaming them to a certain standard in Android?
This is not the pretty good practice, but in the end, if you don't have separated dimensions for Android too, then, somehow you can considerate the ratio like this:
#1x -> mdpi (the baseline)
#2x -> xhdpi
#3x -> xxhdpi
You need to use a tool that does what you need, just take the best image with the best resolution from iOS images, and use this link to generate the ic_launcher for android.
To answer your question, when you are inserting images or icons into the drawables folder of Android, you need to ensure the following:
The names of the images/icons cannot contain capital letters.
The file type of the image/icon is either .png or .jpg. .svg is not allowed.
You also can't have symbols like -, _, or #.
You can also refer to this article about naming Android Assets. And this website allows you to make your own app icons.
I hope this answers your question.
Previously I made some apps with Adobe Flash Builder. That's works great but is not the best choice is some cases so I start with developing Android apps with use of ADT.
Like in Flash Builder you can set several icons for different screen resolutions. I can understand why but found it is not really necessary when creating one high resolution icon, this works fine (scaling down is better than scaling up). This also avoid the extra work that is needed to create these icons, just one icon.
Long story short, I want to create just one icon, 144x144 pixels at 96dpi and tell Android to use this icon.
Also I want to point the application icon to the asset directory instead of the res/drawable directory. The reason for this is that the icon can be reused by the (web-)application and for another reason, I have made a webApp tool to create a compressed version of a webApp and put the contents in the asset directory of a Android project.
Because the webApp can also run in the browser I have already created some icons (like favicon, apple-touch-icon and apple-touch-startup-image) and want to reuse these icons in the Android project automaticly.
The idea is also to create an application project template so it is quite easy to create a android app of a webApp.
Question
Andy idea how to change the location of for example the application icon? Using a path doesn't work (it generates an error, can't compile).
android:icon="#drawable/ic_launcher"
android:icon="assets/appicon.png" #<- doesn't work
Actually found the solution myself and is pretty simple. The only thing that is a bit tricky in ADT to validate the new declaration because at first 'it says' that the declaration is invalid. The workaround is to cut (ctrl+X) the declaration, do a project clean by Project|Clean and then put it back by paste it again (ctrl+V). Weird but true ;-)
You can declare a string resource like this (in XML file):
<resources>
<string name="app_icon">assets/appicon.png</string>
</resources>
android:icon="#string/app_icon" <- this works
Then you can use just one high-res icon image as icon for all devices! Looks great! See also picture below (between red rectangle ;-)):
I am using the Android 9-patch tool to generate my 9-patch images. I have to support a number of different resolutions and button states. This means that for a single 9-patch button I need to generate 16 separate assets. Currently I am generating each of these separately using the Android 9-patch tool interface which is taking a lot of my time. If I was able to specify the 9-patch dot for a range of buttons which have the same properties this would save me a lot of time. Is there the equivalent of a command line tool or other approach which would help.
Thanks
Here is a nifty looking tool I just found. I cannot verify its accuracy or stability, but it claims to do what you want.
You can try to use the Android Asset Studio at http://android-ui-utils.googlecode.com/hg/asset-studio/dist/nine-patches.html.
Well, there's is no tool as you like afair, but you could easily craft small script (PHP, Perl whatever) that would combine two images (main image + 9-patch dots) together. Or you can save dots separately and then load it into GIMP or Photoshop as layers and export as single final 9patch PNG.
I am investing some time doing drawables for an Android project and I am looking for alternatives.
Currently I do them on Adobe Illustrator and with some drawables I can use Android Asset Studio (e.g. drawables for the action menu). The problem with Android Asset Studio is the lack of possibilities to use my own color (we can only use white/black colors).
I wanted something like Android Asset Studio where I can give him a HD image and he creates all drawable sizes. Is that possible?
Another option could be a program/script that could allow me to say "I want to scale to these resolutions" and he does it for all images.
What you're looking for is called a batch resizer, but without knowing what you're working with, it's hard to give a recommendation. For instance, you can use both Photoshop and Gimp for it. I believe Gimp will require a plugin, while Photoshop has the script built-in.