Currently I am developing a android mobile app using android studio (java). Since it should multiple screen size I make another layout file with respect to the screen size which i need(xxx-high density). But still it is not supporting. The buttons are moving out of the screen.
I have used Relative Layout as a parent layout for all of my activity.
please somebody help me to get out of this trouble.enter image description here
Just do as the folowing,
res -> layout -> New -> Layout Resource File
Dont forget to give the same file name, just specify the size.
Related
I am working on an app where I have to upload images to a recycler view from either the gallery or from camera. The recycler view should have a button where I can add the image from.
The image below shows what I am trying to achieve.
My question is, is there a library for android either java or kotlin that can help me achieve this?
Any help will be highly appreciated.
You can use UltimateRecyclerView library for your purpose
This library supports different layouts and many more other useful features. You can create different layouts for images and plus button and define different code logic by checking the position of the clicked item.
I finished the layout for phone and it's working fine. Now I want to open this app on tablet too, but the layout isn't that nice. How can I make two layouts?
Thanks!
to create a tablet version of your layout in Android Studio go in Layout Design and click on the rotating device button.
A picture of what I'm talking about :
This will create a copy of your layout for higher resolution.
You can also create a Landscape version if you have vertical and horizontal orientation in your app.
Hope it helps!
I am making an Android App and have created the basic layout for devices.
But I also want to make the layout for Tablets. I know I can use the different size layouts.
But what should be the ratio of normal layout sizes to the tablet layout size. Any help will be appreciated.
The documentation you are looking for is here . The value you should be using is 600dp as described in the docs
res/layout-w600dp/main_activity.xml # For 7” tablets or any screen with 600dp
# available width (possibly landscape handsets)
So basically you can create a layout-w600dp folder inside of the res directory to be used as the layout for tablets.
When I run the app on a real device and I rotate the app to landscape mode most of the content is been cut off and I can't even scroll on the landscape mode. What XML or java code can I use to make the app rotate without loosing it content?
Please check the attached image to understand what I mean
In the folder "res":
create a new folder named "layout-land" where you copy the layout (the layout need to have the same name).
Modify the content of the layout as you desire to fit the landscape.
When you rotate your phone, the system will detect that it exist a layout land folder and a layout adapted for landscape.
Can you post your layout code? I will help you to organize the views.
I am working on a small app, with 3 buttons on left corner(Vertically) and a edit box which covers rest of the screen.
I want to run this app to be able to work on all screen resolutions.
So I have used Relative layout, linear layout and Android:weight for buttons, which equally share the size of the buttons and works fine.
My Question is am I doing it wrong?
Should we design different layouts for different screens or using same layout out but adding properties like weight and padding is fine??
So, you want a responsive layout for your android app.
Pointing to your question :
[+1] layout -> Relative / Linear (in addition to the relative layout)
property (Buttons) -> Android:weight
is the right thing you are doing for your app.
Alternative:
But if you want a more responsive design then you could follow responsive design techniques by using html5 & css3 media queries etc. . And, could opt for a fluid layout also. By doing this the advantages you will have are:
Won't have a native UI only for android but the same could be used for other platforms (iOS,blackberry etc.) if you require.
The design would be more seamless with the native browser and the widgets won't get obsolete ever in the newer versions of your android
platform also and changes once done would be reflected over the other
platforms too.
More info: MUST READ IF YOU WANT CLEAR UNDERSTANDING OF HOW TO DESIGN FOR ANDROID
http://developer.android.com/design/style/devices-displays.html
http://developer.android.com/design/style/metrics-grids.html#48dp-rhythm
you can see this Supporting Multiple Screens and also Designing for Multiple Screens
To support different screen size you have to implement different layout.
Under res directory you should create these directory:
layout
layout-small
layout-large
layout-xlarge
In each directory you implement your layout. be aware to call all the layouts with the same name.
If you want to support the landscape mode too you have to add:
layout-small-land
layout-large-land
layout-land
When, in Eclipse, you open the layout select the tab called 'Graphical Layout' , you will see how your layout will be displayed. Change the screen size using the options in the upper left side and you can check how it will be displayed in different screen size.
If something is wrong you can open the xml using and correct it.
I've created a small tutorial here Multiple screen support
Hope this help you