Android Question Design responsive

arielpanot

New Member
How to make my design responsive? When I layout the designer it fits on the screen but when I run the program it doesn't follow the position of the text/views
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
One of the main objectives of the Layout Designer is to make it easier to design a layout that will adjust itself to fit different screen sizes. If your layout is not fitting on the screen then you are definitely doing something wrong. There is a guide to using the designer here and there is a YouTube video here. If these do not help you then try posting a simple layout on the forum and someone will probably show you where you are making mistakes.

Fitting a layout to different screen sizes is to a large extent achieved by using "anchors" to set the positions of the views relative to the screen edges. If you have not used anchors then that is probably the reason that you are having problems.

Here is a very simple example. This layout has a label at the top of the screen, two buttons anchored to the bottom corners of the screen, and a panel that fills the area between them. They all use anchors to set their positions.
 

Attachments

  • Layout.zip
    8.5 KB · Views: 102
Last edited:
Upvote 0

josejad

Expert
Licensed User
Longtime User
Upvote 0

arielpanot

New Member
One of the main objectives of the Layout Designer is to make it easier to design a layout that will adjust itself to fit different screen sizes. If your layout is not fitting on the screen then you are definitely doing something wrong. There is a guide to using the designer here and there is a YouTube video here. If these do not help you then try posting a simple layout on the forum and someone will probably show you where you are making mistakes.

Fitting a layout to different screen sizes is to a large extent achieved by using "anchors" to set the positions of the views relative to the screen edges. If you have not used anchors then that is probably the reason that you are having problems.

Here is a very simple example. This layout has a label at the top of the screen, two buttons anchored to the bottom corners of the screen, and a panel that fills the area between them. They all use anchors to set their positions.
I run this but this is what I'm saying it got cut off
 

Attachments

  • Screenshot 2024-05-13 181458.png
    Screenshot 2024-05-13 181458.png
    22.4 KB · Views: 91
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
I run this but this is what I'm saying it got cut off
Yes - I see. But you are running it in an emulator that I know nothing about. I have tested the app on a 'phone (Pixel 4a) and a tablet (Samsung Galaxy Tab) and the layout looks exactly as it should on both devices. I suspect that there is an emulator setting that you have overlooked, or something unusual about the emulator. Have you tried a real device?

Edit : Also the text in the label should be centred. Again, this is as it should be on both real devices but incorrect on the emulator.

Edit again : . . . . and the layout works in both portrait and landscape on the devices, of course.
 
Last edited:
Upvote 0
Top