Font size of text

后端 未结 8 2006
伪装坚强ぢ
伪装坚强ぢ 2021-01-29 04:29

I have created different layouts (layout, layout-small, layout-normal, layout-large, layout-xlarge) and for values (values, values-ldpi, values-mdpi, values-n

相关标签:
8条回答
  • 2021-01-29 05:20

    Create folder like values-mdpi , values-w360dp-mdpi in res folder.

    create dimens.xml on both folder.

    and paste it below code in values-mdpi dimens.xml

    <?xml version="1.0" encoding="utf-8"?>
           <resources>
               <dimen name="textsize">14sp</dimen>
    
           </resources>
    

    and paste it below code in values-w360dp-mdpi dimens.xml

    <?xml version="1.0" encoding="utf-8"?>
           <resources>
               <dimen name="textsize">18sp</dimen>
           </resources>
    

    then apply text size on your activity

    android:textSize="@dimen/textsize"
    
    0 讨论(0)
  • 2021-01-29 05:24

    Just create layout folders like layout, layout-small, layout-large, layout-xlarge then create values folders like values, values-ldpi, values-mdpi, values-hdpi, values-xhdpi. Then you can create values folder depending upon height or width and belongs to ldpi or mdpi i.e values-w360dp-mdpi or values-h600dp-mdpi. Then android automatically picks layout depending upon screen size and values on depending height or width.

    0 讨论(0)
提交回复
热议问题