Different text size for different hardware

后端 未结 3 996
长情又很酷
长情又很酷 2020-12-24 08:28

I have a edit text layout as below and I want to know, is there any way to provide different size for it for different hardware depending on its screen size? For screens bel

3条回答
  •  隐瞒了意图╮
    2020-12-24 08:59

    If you use in a configuration dependent way, you will override default size for all devices (22dp for smaller, 40dp for larger devices). If you want to leave textSize as it was by default for smaller devices, and only override it for larger devices, you can use styles:

    res/values/styles.xml:

    
    
            
    
    

    And in the layout:

    
    

    This way textSize is left untouched for smaller devices, and default value from current theme is used.

提交回复
热议问题