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

后端 未结 9 2227
鱼传尺愫
鱼传尺愫 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:43

    There are three ways to do this :

    1) Put your images and icon in different drawable folder including drawable-mdpi , drawable-hdpi , drawable-xhdpi , drawable-xxhdpi , drawable-xxxhdpi which will be access image from particular folder based on screen resolutions. Don't apply fixed values everywhere for image. Fixed dimensions can be vary with different device and image will be looked stretch. So use wrap_content

    2) Set dimensions in dimens.xml for different values folder.

    values-mdpi\dimens.xml
    values-hdpi\dimens.xml
    values-xhdpi\dimens.xml
    values-xxhdpi\dimens.xml
    values-xxxhdpi\dimens.xml
    

    3) Use LinearLayout with proper using of android:layout_weight.

提交回复
热议问题