1

I am developing an android app and I want it to look good on every device, The way I thauoght was to set margin and size of views dynamically in java code, It seems OK and my app looks good on different mobile size, But recently I've been wondering if this is a right way and how this can effect my app, what is the best way to write a responsive app?

Nazila
  • 1,353
  • 4
  • 15
  • 28

2 Answers2

0

you can create separate resource files for the separate screen sizes by adding dimension qualifier to your resource directory. This will make your resource directory screen-size-dependent. This will provide you separate files for separate screen sizes like values-ldpi, values-hdpi, dimens-mdpi.... etc.

You can have a brief idea by having a look on this, https://developer.android.com/guide/practices/screens_support.html

You might have a try first... or you can try this . Hope this helps!

Community
  • 1
  • 1
Tahmid Rahman
  • 748
  • 1
  • 8
  • 20
0

You can make a responsive app by using constrain layout, using guidelines, and can use qualifiers.

Using a qualifier developer can make a different screen for different qualifiers.

eg: For landscape, we can make different layout

For better understanding, you can refer: documentation for responsive screen

Anusha C
  • 37
  • 6
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 30 '23 at 15:00