Xamarin.Android - Does frame layout changes for each phone screen?

46 Views Asked by At

I'm making a project in Xamarin.Android. Is it "safe" to use FrameLayout or it changes a bit compared to the phone screen size? What similar Layout should I use instead if FrameLayout isn't the best?

1

There are 1 best solutions below

0
Liyun Zhang - MSFT On

The point of making the view fit the different size of android device screen is using the weight instead of the exact numerical.

Google suggest the developers use the dp + self-adaptive layout + weight to do this.

  1. dp is the system recommended unit, and it will fit the screen better.
  2. self-adaptive layout contains such as linearlayout and relativelayout and so on. These layouts are all ranged based on a root view.
  3. weight means the child view's size is based on the scale.

So you can try to use the dp + framelayout or the other layouts such as linearlayout + weight + weight to do that.

In addition, the framelayout is to sample and rarely used. And for the native android, the ConstraintLayout is recommended by the google. You can check my answer in this case to learn how to use it.