Scale up the app on large devices (generic scale) - android

I have finished my app and it looks great on phones (regardless of the density). Is there a way (attribute or generic method I can call or some sort of settings) that would just make all the screen elements ( images, buttons and texts) bigger for large screens such as tablets.
I remember one of the tablets (I think TF), had an option to just scale up the whole app to fit the screen. This could be only a feature of that specific company or it could be an attribute set on the app. Perhaps I can achieve the same behavior?
PS: I know some may disagree saying that this may not look good on tablet, not the right way and that specific layouts should be provided for large screens but that's ok. I have considered that and I am ok with my approach. My app target is mainly phones but if it runs on 7 or 10 inch tablet (rarely), I want everything just bigger.
Thank you

Related

Android User Interface Scaling

I have a project I am working on where the UI I have developed looks great on a 7" tablet, but the moment I try to use the app on a 10" tablet there is a lot of extra space to the right and bottom of my UI elements. Is there a way to scale UI elements to be bigger based on the size of the screen?
I need the UI to look exactly the same on every resolution possible. It should be noted that I am restricted to Eclipse and am programming on an older version of Android because the utilities I have been supplied with are older utilities.
Wish I could supply a screenshot, but I 100% cannot.
You can use different layouts for different screen sizes.
layout-sw600dp ( for 7 inch tablets)
layout-sw720dp ( for 10 inch tablets)
The system will automatically pick the layout per current device size. Just make sure to have the same layout name and id of the components in the layouts or it might cause exceptions if mismatch is found.
If you want completely different layouts for different sizes ( file names still have to be the same ), you can determine which kind of device it is, you can follow the description in the following's accepted answer.
Determine if the device is a smartphone or tablet?
Now using the above method, you can find appropriate views using IDs or whatever way you prefer without causing exception. I personally just change the dimensions of things and keep the ids same.

Different Designs and Different screen sizes and Densities

I have read an much more documents on android and other blogs about how to support multiple screen sizes. And To some extent I am successful in making some good looking designs for apps. Now let me start from the start what is the problem and what I wanted to ask from you guys.
Android has now different screen sizes of different screen densities and having different resolutions. so We have to face 3 different things the size , density and the resolution.
Now Let take example of Samsung s4(xxhdpi device having 1080*1920px) , Samsung Grand (hdpi 480*800px) and both has same screen size that is 5 inch
and Samsung galaxy note 10.1 (Mdpi devices ) 10 inch screen size.
Now android says to make different drawable and put them into respective folder, its ok, let suppose its done. Now what ?
lets suppose , What if I have to set the image in left top with the marginleft of 5 dp and some other views according to them with different specific paddings and margins in dps and suppose I have set all of these in my layout according to hdpi device, which we know is not going to look good in samsung s4 xxhdpi device and tablet.
and Also as design pattern says to change design for the tablets according to your need , but on the other hand the support of making different layout has been deprecated now we have to use different values folder.
so in short what is a best way and what is clear thing for making drawables.
how should we re size our drawables to support all devices , and also if making different layout has been deprecated now what should we do to make our design look good and approximately same in all devices?
also how to judge that device is tablet and we should now start showing the multi pane design ?
please do not refer me to android developer website , I know its very helping and I learnt a lot from there , but right now I just want to discuss the technical issues and want to take advantage of some experienced developers. Thanks

Detecting 'Phablets' like the Note 3 for layout

I am trying to differentiate layouts in Android (ICS+) for larger devices like the note 3 but finding it next to impossible to do without reading the device name or attempting to calculate physical size in code.
The (deprecated) size attribute for the note 3 identifies as normal, as does the HTC One Mini.
Same goes for using sw350dp / xxhdpi. Not sure if the HTC Mini is the unusual device here, but I would imagine all the newer high-end mini handsets will be the same. I also don't want to use px values if I can help it as smaller devices can (and probably will) go up to 1080p, and notes prior to 3 use lower.
Is there something I am missing here? If not, is any reliable way to calculate the physical size or am I better off hard-coding device lists to provide optimal layouts?
EDIT
So part of this was due to multiple overriding layout folders causing some funkiness and I now have the Mini using the correct values, however I am still in the same situation with the S4 and Note 3 using the same resources. While this is not as bad, it still isn't optimal.
I expect that the Note 1 and 2 will also drop back to the lower DPI resources meaning their real-estate won't be utilised either.
Do NOT use screen size approach. Some phablet users who have Galaxy Mega 5.8/6.3 device or Nexus 6 may have unintended experience.
Use resource based approach sw600dp and sw720dp as below link.
Tablet or Phone - Android

Background images in Android: A separate image for each separate device?

I need to develop an Android application and I am a starter to this environment. Actually, we need to port our existing application written for iPhone with Objective-C to Android. We are targeting four devices for now: Samsung S2, S3, Note and Note 2. The application completely consists of custom images in its buttons and backgrounds. As from my experiences in iOS development, we designed 320x480 and 640x960 backgrounds for non-retina and retina devices and the system selected the correct ones provided we give appropriate #2x suffixes. I am trying to understand the Android's way of handling this. I have read the [Supporting Multiple Screens] (http://developer.android.com/guide/practices/screens_support.html) document, but I am still confused on a few things.
As far as understand, there are size and density categories named as small,normal,large and xlarge and ldpi, mdpi, hdpi, xhdpi. We need to generate appropriate bitmap resources and place them under correct "drawable-X-Y" folders. This looks like an advanced version of the #2x notation in iOS. But I don't get exactly how we should prepare background images. For example Note1 and Note2 have resolutions of 449x718dp and 431x767dp respectively if I calculated correctly and therefore they both fall into normal size category. If we prepare a background image for Note1, its screen ratio won't be the same for Note2 and the background image will have to be resized. So, the system does not handle different sized devices which fall under the same size and pixel density category. So, what I do not get is how this system allows us to reuse the same background image for similar devices under the same size-density category. Should we prepare separate background images, say, for Note1 and Note2? If so, what is the meaning of this categorization, am I missing something?
We are targeting four devices for now: Samsung S2, S3, Note and Note 2.
Unless you are controlling the distribution of the app, and can somehow limit it to run on those devices, then at best those are sample devices. If, for example, you are planning on distributing your app via the Play Store, your app will wind up on many others, with a range of screen sizes, densities, and resolutions. While you can perhaps limit the size/density combinations via <compatible-screens> elements in your manifest, there are still going to be a range of resolutions.
So, what I do not get is how this system allows us to reuse the same background image for similar devices under the same size-density category. Should we prepare separate background images, say, for Note1 and Note2?
In the case where you can limit the distribution of your app to those four devices, if you want to use android.os.Build to sniff on the device and choose a different image based upon the device model, you are welcome to do so.
In the case where you are distributing the app to a wider audience, where your app could run on arbitrary devices, you have no practical means of determining, up front, what all possible resolutions might be used. Hence, you have no practical means of creating custom images for each possible resolution. In this case, you will need to rethink the approach of your app, learning from the techniques that millions of other developers of desktop and Web apps have used for dealing with arbitrary resolutions.
It is better to use dp for your control sizes and use 9-patch for Android apps. Android SDK can not handle this kind of detailed categorization. the hdpi/mdpi large/xlarge screen can help to an extent, but your case I think there is no easy way. If you absolutely need to do separate images for each device, then you may consider to do layouts like this:s2_layout_actvity.xml, s3_layout_activity.xml, and in each of them use corresponding images. And detect what device you have before you call the setContentView.

Large screens layout not as expected

I developed and application and uploaded all the images in the respective drawable folders (different pixels for different desnities).
Now I am confused when it comes to layout. If I used the layout editor with 4.1 inc (thats considered Med screen I guess?) everything looks great.
Now when I use the editor with 10.1 inch which is the tablet, then I see icons very small and the text is small. I have not run the emulator yet.
So I am wondering:
1- why would the text be small although I didn't specify text size? Shouldnt scalle appropriately? or should I give it a specific size for bigger layouts?
2- Why the icons are small given that I provided the different drawables? I thought it would scale up accordingly.
Please don't give me the supporting multiple screens link in android as an answer, as I already went through it and still no luck with above. I need your personal advice as I think I am missing something here
Thank you so much in advance
Android support for different screens is a little tricky. That's because you can have large, small, medium and xlarge screens, plus high, medium and low density ones. There are a dozen possibilities (xlarge low density, small high density) and not a single resolution is defined. So you must know the principles which the API is designed upon and must define your layout thinking about the role the widget has inside your UI. You also must bear in mind that your layout won't be pixel perfect on 100% of devices, so your aim should be being usable on all possible devices.
In your specific case it seems that either you don't manage to specify the correct resources, or the system doesn't pick up the right ones for you, but I must remark that it doesn't make sense on Android to talk about big, small and scale: you should design your layout with a (good) webdeveloper mindset, who daily deals with tons of different displays, resolutions, physical sizes and even devices.
I also suggest not using the graphical builder if you are new to Android, because you really need to know how Android lays out components, otherwise you will come back to SO very often :)
If you do not specify the text size in your layout file Android will take the default value, which is most likely in DIP (density independent pixel) therefore it will be the same physical size on any devices. That should explain why the text looks so small on your 10 inch tablet.
What I would do in this case is have 3 layouts for each activities and specify the text size for larger devices (given you already like the look on phones) and put them in this folder scheme :
res/layout/layout.xml // phones
res/layout-sw600dp/layout.xml // 7” tablets
res/layout-sw720dp/layout.xml // 10” tablets
Information above was taken in this article. I have this applied in my current personal project and so far it works like a charm.
Secondly, as far as icons go, I'm no drawable expert but if you provided the same file in each folder (like I think you did from what I understand in your question), it will not make it scale. You'll have to create 4 difference icons, one for each possible pixel density.
Information about icon sizes can be found on this page.
Hope this is of some help to you.
My experience with the Android device zoo drew me to the sad conclusion that the built-in screen size/layout facility is useless. Cases in point, straight from support:
a 10 inch tablet with Android 2.2. Screen size xlarge is not supported by Android 2.2
Kindle Fire, which is 7 inch and claims it's xlarge.
I ended up putting all three layouts (med/large/xlarge) into layout, loading one based on run-time density and resolution, and providing an option for user to force a specific layout.
Just sayin'.

Categories

Resources