Problems with supporting tablets and handsets simultaneously - orientation - android-layout

In my main Game Activity I force the orientation to portrait. This is clearly not a good idea on tablets. What is the best way to check the SDK version and not do this for tablets (or perhaps even force landscape)? I assume I then need to specify a layout-land-large folder and put the files in there. Is there anything else I need to do? I read something somewhere that I also need to specify screen sizes somewhere in the manifest.
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
I.e. should it be in -large or xlarge?

I would definitely check out the documentation here.
You can simply declare two different layouts in and folders specifying two different View orientations.
Please let me know if you need any clarification, and I'll get back to you :)
Hope this helped!

res/values for handsets in portrait mode.
res/values-sw600dp for 7" tablet in portrait mode
res/values-sw720dp for 10" tablet in portrait mode
res/values-sw720dp-land for 10" tablet in landscape mode
and reference to Android Developer Guide -- How to support multiple screens

Related

Drawable icons for app

Recently, I've been working for some theming project for Android launchers. I need some guidance and advice from the people around here that could help me with this.
I have created one sample icon for Opera mobile with the size of 192x192. The question is, if I made that icon size as mentioned, should I create another size for it, e.g. 128x128? I'm a bit confused.
Thanks.
I am not sure if understand your question. If you add a drawable resource to Android Studio, it automatically resizes it to multiple sizes. If you have created one, that will be resized automatically.
Hope this helps.
If you want to design icons for android, you better design some for different resolutions. You have to make an icon for each. See at this article https://developer.android.com/guide/practices/screens_support.html#overview. There are the different densities and the multiplication factors.

Android Responsive design using android studio

Hi all !!
I'm newbie to android, Can i get any solutions to make my android app layout that fits in all screens.
If there is any tutorial on it, that would be appreciated !!
Thanks,
Create the following folders in res and add the xml in that
res/layout-small
res/layout-normal
res/layout-large
res/layout-xlarge
And open it from studio layout and make changes.
this link helps you.
The Android resource system gives you the tools to provide alternate resources based on the available width, height, or smallest width — important measurements that serve as the basis for choosing when to change our UI based on the space available.
Width and Breakpoints
Width is perhaps the most important dimension when it comes to choosing when to change your UI. This is because width is the basis for the breakpoint system.
A very good example is here

windows 10 UWP UI design for mobile device

I am working on windows 10 mobile app. If I design an UI for 5' device, it doesn't look good on 5.2' device. Also on emulators of different screen size show messed up UI. Is there any work around this? Or do I have to design it for every screen size?
Usually, please avoid to have fixed Width/Height for your controls. With a Grid layout, you can set columns/rows and place your controls inside each cells. This is a first level to adapt properly your interface. In addition, UWP provides AdaptiveTriggers if you want to adapt the layout based on the screen resolution (cf. https://channel9.msdn.com/Series/A-Developers-Guide-to-Windows-10/07) for additional information. Last but not least, please check Design&UI documention on https://developer.microsoft.com/en-us/windows/design.
The trick is with UWP that you can design for every screensize at once. It's just a responsive design you use (either HTML/CSS or XAML). But you have to use the right controls and settings.
Some guidance on how to design for various sizes can be found at the MSDN design page.
To create a dynamic layout with XAML, see this article. There are various panel-types you can use to do the layout (see this article). But if you really want to build a responsive UI (or change it dramatically in various sizes) RelativePanel is your friend.

How to show website the same way on phone like on PC

Is there any way to show my website exactly the same way how it works on PC, tablets or notebook? I've got full HD laptop and i'm using Chrome - everything works great. On my tablet 10" I also have full HD resolution and Chrome and my website shows like this one on notebook. When I try to to show it on my full HD Lumia 1520 it's crap. I don't use Chrome here so I can understand that some element can be broken by interpreter but it's so approximate that every element go on the others. It looks like 640x480.
Is it some way to force approximate?
If the site developed is not responsive according to the screen size it will not display the content present on it in well manner, you must use bootstrap in your website to make it responsive for all kind of screen resolutions. It may has problem in the CSS. So check the css you used.
Try to use meta tag called view-port. There are different situations and you may set up your website appearance with media queries for responsive results or manage it for being non-responsive but comfortable.
If you need second result - don't use any responsive frameworks or prevent them of using responsive techniques.
There are to much different situations so I can help only if you'll show me the code you have.

Opening a new browser page on the second monitor

Well, simple situation. Is it possible to detect if a user has a dual monitor setup from a web application?
If this is possible, is it possible to open a child browser page on this second monitor, so the new window doesn't overlap the old one?
Reason why I ask: I'm working on a web application and at home I have a dual-monitor system. When I go to the administration part of this site, I want it to open in a new browser, preferably on the other desktop. Of course, I could just click, then drag the new window, but doing this automatically seems more fun. :-)
Don't think JavaScript has the proper functions for this. How about Java itself?
I don't think you'll be able to directly detect a dual monitor setup, but you can probably make a good guess by looking at their screen resolution, using javascript's screen.width and screen.height. If the ratio of the width to the height is 8:3, its a good chance they have 2 standard 4:3 monitors side by side. You can do a similar calculation for 16:9 or 16:10.
Using maxpower47's suggestion about resolution, the only way to display the page on the other monitor would be to open a popup, and use the options to set the top, right, width and height properties so the window will appear on the second monitor in a decent size.
Here is a link that describes how to do this: http://www.netmechanic.com/news/vol4/javascript_no7.htm

Resources