/**
* add by derekguo
*/
private static final int HVGA_HEIGHT_PIXELS = 480;
private static final int HVGA_WIDTH_PIXELS = 320;
public void adjustFontWidthAndHeight(View view,int direction,int type) {
LayoutParams linearParams = (LayoutParams) view.getLayoutParams();
Display display = getWindowManager().getDefaultDisplay();
int w = Math.max(display.getWidth(), display.getHeight());
int h = Math.min(display.getWidth(), display.getHeight());
Log.i(TAG, display.getWidth()+" "+display.getHeight());
float ratio_w = (float)w/HVGA_HEIGHT_PIXELS;
float ratio_h = (float)h/HVGA_WIDTH_PIXELS;
Log.i(TAG, ""+ratio_w);
if(direction == 2){
if(type == 1){
linearParams.width = (int) (ratio_w*68);
linearParams.height=(int) (ratio_h*40);
}else{
if(type ==2){
linearParams.height = (int) (ratio_h*200);
}
}
}else{
if(direction == 1){
if(type ==1){
linearParams.width = (int) (ratio_h*80);
linearParams.height=(int) (ratio_w*65);
}else{
if(type ==2){
linearParams.height = (int) (ratio_w*325);
}
}
}
}
view.setLayoutParams(linearParams);
}