动态设置图片的宽度和高度
动态设置图片控件的宽度和高度:
imageView.getLayoutParams().width=600;
imageView.getLayoutParams().height=400;
设置图片(src):
imageView.setImageResource(resId);
android获得屏幕高度和宽度:
1
、WindowManager wm = (WindowManager) getContext()
.getSystemService(Context.WINDOW_SERVICE);
int
width = wm.getDefaultDisplay().getWidth();
int
height = wm.getDefaultDisplay().getHeight();
2
、WindowManager wm =
this
.getWindowManager();
int
width = wm.getDefaultDisplay().getWidth();
int
height = wm.getDefaultDisplay().getHeight();