原文链接:http://blog.youkuaiyun.com/sunboy_2050/article/details/6885755
适应不同Android手机屏幕大小
240*320
320*480
480*800
480*854
540*960
800*1200
800*1280
public static int adjustFontSize(int screenWidth, int screenHeight){
if (screenWidth <= 240) { // 240X320 屏幕
return 10;
}else if (screenWidth <= 320){ // 320X480 屏幕
return 14;
}else if (screenWidth <= 480){ // 480X800 或 480X854 屏幕
return 24;
}else if (screenWidth <= 540){ // 540X960 屏幕
return 26;
}else if(screenWidth <= 800){ // 800X1280 屏幕
return 30;
}else{ // 大于 800X1280
return 30;
}
}
本文介绍了一种根据Android设备屏幕尺寸调整字体大小的方法。通过判断屏幕宽度,为不同分辨率的设备选择合适的字体大小,确保应用界面在各种尺寸的屏幕上都能良好显示。
541

被折叠的 条评论
为什么被折叠?



