Aug 12 | 7:20 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Aug 12 | 8:00 PM |
Gabriele | has entered the room |
Gabriele |
Hello Mark!
|
Mark M. |
hello, Gabriele
|
Mark M. |
how can I help you today?
|
Gabriele |
I had a question about drawables and resources and then another about applying layouts to screen sizes
|
Aug 12 | 8:05 PM |
Mark M. |
go right ahead
|
Gabriele |
So I have buttons, I created drawables for them in photoshop and I created it according to mdpi for the size (the resolution was something like 74) and it was all good.
|
Mark M. |
these drawables are the background? or are these ImageButtons?
|
Gabriele |
background
|
Gabriele |
I just wanted to make sure that in order for me to have those drawables be represented well in the other dpi's is to change their size, and resolution in photoshop.
|
Gabriele |
so whatever they were in mdpi, multiply that by 1.5 so it will be good for hdpi
|
Mark M. |
well, first, I'm not a Photoshop user, so I can't provide any specific instructions
|
Mark M. |
second, usually a button background is a nine-patch PNG, so it can stretch to fill whatever is in the foreground
|
Mark M. |
(actually, a series of nine-patch PNG files, for different states)
|
Mark M. |
you don't *have* to use a nine-patch PNGs, but that's what the standard buttons use
|
Gabriele |
Yeah, i tried 9 patch and it lost some of the photoshop effects so i tried with just a normal ong
|
Mark M. |
well, bear in mind that if Android has to stretch those PNGs to deal with your foreground, those "photoshop effects" may get screwed up that way too
|
Mark M. |
all that being said, yes, saving the image in different resolutions based upon density changes is the right recipe
|
Mark M. |
for whatever densities you want to ship
|
Gabriele |
sweet!
|
Mark M. |
everything else, Android will resample (again, with possible harm to your effects)
|
Aug 12 | 8:10 PM |
Gabriele |
thats cool i guess, if its small
|
Gabriele |
so for the layouts part
|
Gabriele |
I have been testing these on emulators and of course the larger screened emulators place the widgets that aren't MATCH_PARENT in the wrong spot. How can i compensate for as many screens as possible?
|
Mark M. |
I can't really answer that
|
Gabriele |
a little misplacement is fine, but not when its totally wrong
|
Gabriele |
snap
|
Mark M. |
that's all tied into your layout definitions
|
Mark M. |
and your fragment strategy, if relevant
|
Gabriele |
i havent used any fragments
|
Gabriele |
is that a problem?
|
Mark M. |
layouts are usually flexible enough to handle modest size changes (e.g., 4" to 5" screen)
|
Mark M. |
for larger changes (e.g., phones to 7" tablets to 10" tablets), you need to have a strategy
|
Mark M. |
but I can't help you with that, because I don't know your app, your UI, or your objectives
|
Gabriele |
understood
|
Mark M. |
there's a chapter in the book on large-screen strategies and tactics that gets into this sort of thing
|
Aug 12 | 8:15 PM |
Gabriele |
I found on some stack overflow question that you, if you were trying to cover all screen sizes or specify which ones you wish your app to function on, mention it in your manifest somehow. Is defining the screen sizes your app will support in the manifest a must?
|
Mark M. |
you are probably referring to <supports-screens>
|
Gabriele |
yes!
|
Mark M. |
for tablets, the two relevant attributes are android:largeScreens and android:xlargeScreens
|
Mark M. |
setting them to true means that you have explicitly written support for those screens in your app
|
Mark M. |
setting them to false means that Android should use iOS-ish "pixel doubling"-type techniques to zoom your UI to fit the space
|
Mark M. |
that's the so-called "screen compatibility mode": http://developer.android.com/guide/practices/sc...
|
Mark M. |
usually, that's not what you want, if you want a nice-looking UI
|
Mark M. |
which means usually you want to set them to true
|
Gabriele |
for phones as well?
|
Aug 12 | 8:20 PM |
Mark M. |
android:smallScreens and android:normalScreens are true by default
|
Mark M. |
for smaller screens than you support, false is a filter
|
Mark M. |
so I often set android:smallScreens to false if I am not going to try to take the time to figure out how to squeeze my UI into a < 3" screen
|
Mark M. |
then, apps with such screens cannot install the app
|
Gabriele |
i feel ya
|
Gabriele |
are large screens 7" and up?
|
Mark M. |
there's official definitions in the docs in terms of dp on each axis
|
Mark M. |
roughly speaking:
|
Mark M. |
small is < 3"
|
Mark M. |
normal is 3-5"
|
Mark M. |
large is 5-10"
|
Mark M. |
xlarge is > 10"
|
Gabriele |
well alright
|
Gabriele |
well thats all i got for you Mark. thanks for the info!
|
Mark M. |
you're welcome!
|
Gabriele | has left the room |