How is someone supposed to use the drawables located in ...\AppData\Local\Android\android-sdk\platforms\android-22\data\res in Android Studio projects?
For example, if someone would like to change the Floating Action Button icon to a pencil icon, what is the standard practice?
Is there some kind of documentation available that demonstrates what each drawable XML file actually looks like when drawn? Or are you expected to copy and paste these into your project in order to see what they actually draw?
Surely there is some kind of gallery somewhere...
Unlike any other O.S, Android powers billion devices with different screen sizes, ranging from small phones to large TV sets. And it becomes a primary necessity to run apps with perfect User Experience on all sorts of devices! And for that purpose Android uses DIP or DP (Display Independent Pixels).
And coming to the solution to your question, consider reading from here
And, the general procedure is to generate images of different resolutions for different screen sizes, see this
Also, this video explains it simple!
And in order to generate multiple images with different resolutions for the respective screen sizes, I personally use a resizer tool. Final Android resizer, available here.
hope it helps!
Related
I have a sophisticated design for an Android app and designed using Photoshop.
The app has many drawings and curves which mean I can't use Android Studio to develop it there.
I know there are many ways to slice in Android, but I can't find the best way yet to finish the job quicker and with a higher quality.
The VERY BEST solution - use Zepline online service: https://zeplin.io/ .
It is, this service authomatically calculates all dimensions in 'dp' (you don't have to calculate everything manually)- just select widget and see margins, space between elements, etc. But, the MOST useful thing, is that it converts your pictures into .png files to drawables for ALL densities. It releive you from pain of scanling up and down all pictures.
The answer to this may be, 'you poorly designed your app', which is likely as I'm still pretty new to this.
Issue: I have small game that I created where the background image of the screen is the game board. On it, are locations for scoreboards (part of the image). I am using textviews as the different scores that will display on 4 score boards. My issue that I am trying to address is keeping the textviews placed where I need them, directly over the score board images, when different size and density devices are used. (things move around).
I have this working great on many different devices and densities using multiple resource qualifiers on my values folders. For examples...
sw320dp-xhdpi
sw400dp-mdpi
etc.
I am running in to situations where I have two devices that are both xhdpi and their resolutions are very close.
device 1: 1280 x 720
device 2: 1280 x 768
As I have things currently, this will result in both of them using the same dimens file that is being used to place the text views. Ultimately, this results in one of them aligning things perfectly and the other being slightly off.
Is there a way handle one of them uniquely via a 3rd resource qualifier?
Is there a different way to handle this outside of resource qualifiers?
Did I approach this poorly and there is a much cleaner way to handle what I am trying to do?
Thanks,
Bob
This may not be the in-depth answer you're looking for, but Google announced their new version of Android Studio a while back. It includes the ability to make one layout fit all devices. Check it out:
I'm new to Android development.
I'm trying to develop an app which includes many photos/icons/etc..
I have a designer friend, who designed my app. She has not experience in designing Android appications as well.
What kind of material does she need to provide me with?
I mean, she sent me a PDF where I see each screen of the app.
Now, do I need to get each photo/icon that is used in the design in a certain way?
Let's say, for each photo do I need to ask her to give me 4 versions: ldpi, mdpi, hdpi, xhdpi? anything else? should I ask for PNG formats?
What else do I need to receive from her in order to implement my app without bothering her anymore?
Thanks
It is preferable to ask for SVG instead of maintaining all the ldpi,mdpi,xhdpi ... images.
You should ask her following things:
According to screen wise : -
all the hex-colour codes.
if used any special fonts then .ttf, .otg files of those fonts.
I guess that is enough. I hope this helps :)
Edit
Your Comment : -
Thanks! can you elaborate on the "screen-wise"? do I have to get the svg for each screen size? There are a lot of screen size. Do you mean xlarge, large, normal and small?
There are Two options for you 1. Either user PNG or 2. use SVG just like Mr. Frank N. Stein has commented you need to user library for those. check out this link for more info.
and by "screen-wise", I meant was, if your app has 3 screens then all the non-repeating images/icons you have to take those from your designer.
and if you choose to take PNG you need not worry about different sizes of the device and different image size required for those devices.
I hope this solves your doubt if not feel free to comment!!.
No. you don't need to ask your friend for all the images, it means for all the resolutions, you can only ask your friend for the higher resolution, just because once you will get that resolution from this you can make all three small resolutions mdpi, hdpi and xhdpi respectively.
Always note that higher resolution can generate lower resolutions but that's not possible to create lower resolutions to higher resolutions.
So, you just need Xxhdpi icons and from it you can make the rest of all.
I have been learning android development and I am still new to this.
I have already designed many apps for iOS.
Is there a better way to have my layouts as easy as iOS?
because in iOS I only have to drag and move it wherever I want . Where in android I have to insert tables and edit XMLs, which I find very confusing and not flexible to deal with.
I have read and watched many tutorial and still find it a bit difficult to deal with
Thanks
There is a layout editor for Android that you can use in Eclipse. Is that what you're looking for?
http://developer.android.com/guide/developing/tools/adt.html#graphical-editor
The short answer is NO. The long answer is that this is how it's done on Android, and it's much more flexible than the iOS method. Just imagine making Android app the iOS way and support screen sizes such as 240x320, 320x480, 480x800, 480x854, 540x960, 600x1024, 720x1280...and so on, and it's easy to realize that it would be an impossible task. This is almost certainly why Apple went with "Retina Display" with exactly 2x the pixel density and exact same screen dimension (3.5") - because doing anything else would mean that all the apps would need to be designed specifically for the new screen instead of just providing images with a #2x postfix.
So, instead of absolute positioning and sizing like the iOS, XML is used in Android where designers are tasked to come up with one or more layouts that can support this diverse range of screen sizes.
You can use Eclipse Layout Editor for Drag and Drop with absolute layout. But using absolute layout is not a good practice because in iOS screen size is fixed for all device but in android there are different screen size device are available and if you design a layout considering a single screen size it will be messed on another screen size device. You must follow the norms to create a layout go through this link for more detail.
http://developer.android.com/guide/topics/ui/layout-objects.html
I have a client that gave me a .psd file that contains the entire screen of an Activity with all the graphics. The resolution is 480x800. The client wants the application to look identical to the one in the .psd file. The problem is that different devices have different resolutions and sizes. I know that the density is what really matters but how can I scale the graphics to look the same on all the devices? For example, I exported all the layers and recreated the screen in Android but, for some reason, the screen looks more crowded on a Nexus One (480x800).
One idea would be to create 9 patch images from the graphics and use for ImageViews android:background instead of android:src right?
Isn't it better to have a 320x480 resolution for the graphics? Or do I need for both resolutions? Also, I have to consider the height of the status bar which I understood it is 25dip but I am not certain about this.
So, to summarize, I am interested to find out what is the best way for a client to give you the mockups and graphics so that it is easy for the developer to implement according to the specifications.
That's something that's not easy to solve. Think of a webdesigner, one can't know all the possible resolutions and settings of every browser so he has to scale things accordingly.
In my opinion there are only three approaches here.
First: Let him state what devices he wants to support and only support those devices. Extract the layers with the size of the device with the highest resolution and scale them down on other devices.
E.g. If you have to support two devices with 480x800(2) and 240x300(1), export all images to be 480x800 and scale them down accordingly. Don't write a single application for every device.
Second: Export the graphics with the highest resolution possible and scale them down on all devices relative to the device being used. Imagine, again, a webdesigner. All he does is define margins, paddings, etc. and it will look nice in almost any browser. You should do the same and resize your elements on demand.
Third: Make the application fixed, e.g. define a size of 200x200 for your whole application and just fill everything larger than the screen with a certain color, e.g. black. This happens a lot with java ME applications, they look great on the hardware they were made for and are still playable on hardware that is beyond their time though they look pretty ugly.
Hope this helps,
Robin.