• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How To Support Multiple Screen Size In Android

 
Ranch Hand
Posts: 178
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I create an android app with Kotlin, i want to know how To Support Multiple Screen Size ?
the app is perfect when running on my device but when i install it in another device the measures becomes disordered
 
Saloon Keeper
Posts: 6520
160
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The android developer web site has very extensive documentation on this specific subject; did you go through that? If not, start with that and come back here with any questions.
 
Rancher
Posts: 476
7
Android Tomcat Server Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use ConstraintLayout.
 
Saloon Keeper
Posts: 22270
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Layouts are the mechanism that Android uses to manage different screen sizes. What a layout does is allow you to define rules that indicate the approximate sizes and locations of GUI elements, and then the layout manager will arrange them to fit. This is an approximate mechanism, however, so it's always good to check the results on actual devices.

Layouts are not unique to Android, incidentally. They have been used on lots of systems. The Tk toolkit for Unix/Linux, for example, and the Java Swing GUI.
 
Tim Moores
Saloon Keeper
Posts: 6520
160
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is lots more to know about handling different screen formats and sizes on Android than layouts. As I said, the developer website covers all that in detail, and should be the first point of reference.
 
Maha Sakka
Ranch Hand
Posts: 178
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use the constraint layout but still have the same error
the following code is my xml file
what should I change to make it support for all type of devices
 
Randy Tong
Rancher
Posts: 476
7
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you screenshot both UI and paste here?
 
Maha Sakka
Ranch Hand
Posts: 178
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's the screen shot in the following msg
ss.png
[Thumbnail for ss.png]
ssa.png
[Thumbnail for ssa.png]
 
Randy Tong
Rancher
Posts: 476
7
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe change the height to match_parent?

android:layout_height="812dp" to android:layout_height="match_parent"
 
Maha Sakka
Ranch Hand
Posts: 178
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Randy Tong wrote:Maybe change the height to match_parent?

android:layout_height="812dp" to android:layout_height="match_parent"


I will try
 
Maha Sakka
Ranch Hand
Posts: 178
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to ask you : My file .xml is correct ??
I change
android:layout_height="812dp" to android:layout_height="wrap_content"
is that true ??
 
Randy Tong
Rancher
Posts: 476
7
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may try and see
 
Maha Sakka
Ranch Hand
Posts: 178
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I change to the following code :
I added center as layout gravity
 
Randy Tong
Rancher
Posts: 476
7
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it work?
 
Maha Sakka
Ranch Hand
Posts: 178
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Really, I hope that
 
Randy Tong
Rancher
Posts: 476
7
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Update us once you tried.
 
Maha Sakka
Ranch Hand
Posts: 178
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to ask you if I can put a constraintLayout below a Toolbar Or should I use Menu ??
 
Randy Tong
Rancher
Posts: 476
7
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the late reply. Can you explain what are you trying to achieve?
 
I didn't like the taste of tongue and it didn't like the taste of me. I will now try this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic