How can i support multiple screen sizes in android with single xml layout file

后端 未结 9 2347
鱼传尺愫
鱼传尺愫 2021-02-06 12:54

I want to support my android screen in multiple screen sizes but i can do it with maintaining multiple xml layout file\'s

but according to requirement it i supposed to b

9条回答
  •  北海茫月
    2021-02-06 13:34

    If you want to use single layout and that should support all the screens like ldpi, , mdpi, hdpi, x-hdpi, xx-hdpi then you have to use weight in your layout that will handle screen size for all the screens.

    Here’re a few things:

    If you want to divide the space equally between Views with the same weight – set 0dp as Views’ width.
    If you set View width to wrap_content – size of the Views will depend on weight and content inside each View.
    

提交回复
热议问题