I've been using Xcode for a few months now to create basic iOS applications. Within the startup settings, it allows you to select 'iPhone', 'iPad' or 'Universal'.
I usually setup my applications so that they are locked portrait on iPhone and locked landscape on iPad.
Firstly, how can I setup my project so that it is available to both smartphones and tablets when pushed to the Google Play Store?
Secondly, is there a way to set the orientation to portrait for smartphones and landscape for tablets?
I think what you want is that the app should adopt its view according to whether the device is a phone or tablet. If so, Android provides a very good design called Master-Detail Flow. In a master/detail navigation flow, a master screen contains a list of items in a collection, and a detail screen shows detailed information about a specific item within that collection. And the beauty of it is that, in a phone it only shows the master view as a list and in a tablet it shows both master and detail in two panes.
Take a look at this and this
Also for other adaptive UI see this
The concept of Android O.S is entirely different from iOS. Primarily, think of all the Android devices that exists! Lot of manufacturers, in different screen sizes and with varied configurations. However, an Apple iPhone is designed and manufactured by Apple, and it comes like a brick in different sizes. So it offers more of a robustness to the developer.
But in Android, due to it's versatility, there comes a need to design apps that runs equally same in all devices even with different screen resolutions. As a result, Android uses a technique called DIP Display independent pixels to address while designing. [This] is the perfect place to get a structured knowledge on Android UI designing and scaling to different screen sizes.
Now coming to your second question, Android offers superior flexibility to the developers. And you can easily adjust the orientation programmatically:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); //<-- Landscape mode
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); //<-- Portrait mode
Hope this clearly answers your query!
Related
I have a question about Android Studio.
If I develop an app that I then upload to the Google Play Store, can I be sure that my Android Studio project runs well and looks good on all devices with an Android operating system?
So that the layout that I developed works well on all screen sizes? Will Android Studio do this for me on its own?
Or do you have to develop your XML layout for each individual smartphone with different screen sizes?
I would be very happy to hear from you.
best regards
However, applications created in android studio will be able to fit all api's that you define in your gradle, it is recommended to test in the emulator from the initial api defined in the gradle, but in general it works well on several devices. The test is ideal to check if there will be no crash in some API's but the layout is usually positioned according to the screen of each device.
Good luck on your project.
So that the layout that I developed works well on all screen sizes
For this, it depends on how you did your layout. Android has constraint layout which is the best to use
ConstraintLayout is a layout on Android that gives you adaptable and flexible ways to create views for your apps. ConstraintLayout , which is now the default layout in Android Studio, gives you many ways to place objects. You can constrain them to their container, to each other or to guidelines.
Or do you have to develop your XML layout for each individual smartphone with different screen sizes
For this, it will only base on your use case or if you have different UI design for phone and tablet devices, for example, you want your app to show a two-pane layout on a larger screen (or a tablet), then you have to create a new xml for this. So you'll have mylayout.xml placed in layout folder (for phone device screen sizes) and mylaout.xml placed on layout-600sd600dp (for tablet device screen sizes).
But if you only have on design for both phone and tablet devices, then you only need one xml layout.
In order to give best experience to player, I want provide possibility to choose game resolution from low (best performance) to native (best quality). Sadly, some android devices forces game to run in decreased non-native resolution, and I found no way how to detect native resolution. For example - Samsung Galaxy Tab A 10'' (2016) - have native resolution 1920x1200, but game runs in 1440x900. Fonts and interface looks blurry and poor. It's strange, but our analytic show what about 40% this devices runs the game with native resolution. But not in my case.
So, I need solution.
First option - is to get (in some way) native resolution of the device. Screen.width/height, Screen.currentResolution - not helps. Screen.resolutions - alway empty. android.util.DisplayMetrics - also reports only decreased resolution.
Second option - restrict system (or Unity) to run the game in native resolution only. I checked Unity settings and manifest - found nothing..
Please help. Thanks
What you need is adaptive UI.
If you are using NGUI, see this thread. There are many examples on how to do that. The key component is UIAnchor.
You can either make your UI modular using UIAnchor components, set the UIRoot to be manually sized (and lose pixel perfection), or you can create different layouts. One layout for the iPhone, and another for iPad, for example.
If you are using Unity3D UI, see Designing UI for Multiple Resolutions.
The screens in my app needs to be displayed in the same way on both type of devices, phones and tablets. Currently my app works fine on phones, but they behave weird when run on tablets. The problem occurs with the positioning and size of components in the screen.I have 9 patch images generated for all the images being used but still for some components that I use absolute size/margin values such as 30dp,50dp etc do not seem to be good measures that work well on a tablet. Some of my thoughts/questions are:
PercentRelativeLayout - is it the best solution to overcome this
problem?
Is there a way that layouts can be defined so as to draw
differently on phones and tablets. Please note that that I do not
have any complex menus or behaviour that needs to work differently
on different devices, they are same.
Do I have to develop 2 different apps?
you have to make different layouts for both android phone and tablet.
Look at this link
Read more on the Android developer documentation after reading answers above. Found this resource to be more explicit for someone who is totally unaware of supporting multiple screens. http://www.survivingwithandroid.com/2012/07/how-to-support-multiple-screen-in.html
I'm looking forward to implement a process to develop and integrate user interfaces for mobile developments in for a mobile development team. Currently we are facing problems such as communicating user interface requirements such as screen sizes, etc... by the developers to the UI designers and when developers receive the designs from the UI designers there are alignments issues, low image qualities, font sizes are different and so on. How do the designers test whether their designs are appropriate for the respective screen sizes.
First, I would strongly recommend reading Designing for Multiple Screens documentation carefully as it describes very important aspects when designing your app for multiple screens
Second, Android Development Tools recently added very useful feature to preview your app on multiple screens at the same time. See the attached image, where I am highlighting the button where you can select Preview All Screens
I have been developing Mobile phone apps in Mosync(Cross Platform C++ API - can make apps in iOS, Android, Symbian & Blackberry) & I am looking to develop apps in something else because of the limitations of Mosync.
But I dont want to move to a different API to find they have the same or worse limitations. I am thinking of moving to native API's (iOS or Android) but am open to other cross platform API's aswell.
If I was to move to Android OR iOS OR insert API here would I experience these limitations:
Resizing images is expensive(in terms of RAM & speed). IE, so can Android, iOS handle resizing 10+ images(for eg .png) & display them on screen in a relatively fast amt of time? In Mosync doing such stuff depends on the phone RAM but on HTC Desire(512mb) it takes about 6 seconds which is unacceptable for my app.
Does the API come with its own fonts & layout managers? Mosync doesn't have its own fonts, you have to create & import it & you cant change the colour of a font. You also cannot make the text in a widget display centred or word wrapped, can Android/iOS/other do this?
Can you create your own skins(.png) for buttons(any widget) & set a default API button's skin? This is actually a strength of Mosync where you can change button skins BUT it divides the skin up into 9 sections & only the 5th section is scalable, the others stay the same size, so on small phones a lrg skin looks weird.
Is it a REAL headache designing your app layout because of all the different potential phone sizes there are, so the widgets placement & skins will be incorrect on small screens & images will be out of proportion on large screens? Does the Android/iOS/other API help you by automatically laying out your GUI no matter the phone size & does it automatically scale image widgets & fonts to suit phone sizes?
Any info would be really helpful to a Junior programmer(intern) who is developing mobile apps all on his own & finding the myriad of phone sizes so ANNOYING to compensate for
My experience with Android Code:
Image resizing - Many current android apps seem to meet your
performance requirements although you don't mention the size of the
images which is the key issue.
Android supports many fonts internally, allows full control of font size, type face, colour etc
Android supports a complex variety of 'Drawables' including standard simple
graphics, 9-patch pngs (similar to what you describe) and simple vector descriptions of shapes and colours.
Android was designed with the difficulties of multiple screen sizes in mind; It supports multiple layouts for different screens sizes and orientations. This problem is intrinsically difficult and imho Android takes a lot of the trouble out the process - but it is always going to be a little bit of headache.
I am just reaching production on my first serious android app and have found the development experience pleasant and the learning curve easy.