// 方法1 Android获得屏幕的宽和高
//方法1
WindowManager windowManager = getWindowManager();
Display display = windowManager.getDefaultDisplay();
int screenWidth = screenWidth = display.getWidth();
int screenHeight = screenHeight = display.getHeight();
// 方法2
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
TextView tv = (TextView)this.findViewById(R.id.tv);
float width=dm.widthPixels*dm.density;
float height=dm.heightPixels*dm.density;