字体大小
// 根据屏幕大小自动调整字体大小
public int autoFontSize() {
DisplayMetrics dm = getResources().getDisplayMetrics();
// 获取设备宽度
int screenWidth = dm.widthPixels;
int screenHeight = dm.heightPixels;
screenWidth = screenWidth > screenHeight ? screenWidth : screenHeight;
int rate = (int) (4 * (float) screenWidth / 320);
return rate < 12 ? 12 : rate;
}