Android 根据屏幕大小设置字体

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; 
        
   } 
 }

posted @ 2011-12-05 10:27  囧里个囧  阅读(197)  评论(0)    收藏  举报