skip to Main Content

I am new to android studio and android development. I am trying to use guidelines to make my layout adapt to all screen sizes. I am setting the guidelines by the percentage tag.

For eg: Inside my login screen I am creating different guidelines for margin of the parent layout, guidelines for different buttons and textfields, etc instead of giving them a height and a width, to correctly place them.

My idea behind this is that as the screen size of a mobile phone changes (for eg from google pixel 7 to google pixel 1) then the guidelines will automatically adapt to the percentage of the screen, like if I set the left margin guideline to 5% then it will be 5% on both the smartphone screen size, hence giving me a consistent design, for all screen sizes.

Question: Is this approach of mine correct or will it cause my app to lag or like is there any better approach for adaptive and responsive layout?

2

Answers


  1. Consider using this library for responsive design across devices.
    Developed by **Intuit**:

    https://github.com/intuit/sdp

    Responsive Preview

    Login or Signup to reply.
  2. I think You can try LinearLayout and add padding or margin.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search