imageview 动态设置大小

动态改变imageview的大小设置
 
 
 
 
imag1.setImageResource(R.drawable.xx_ktzxlb);

ViewGroup.MarginLayoutParams margin9 = new ViewGroup.MarginLayoutParams(
        imag1.getLayoutParams());
RelativeLayout.LayoutParams layoutParams9 = new RelativeLayout.LayoutParams(margin9);
layoutParams9.height = ScreenUtils.dpTopx(getActivity(),54);//设置图片的高度
layoutParams9.width = ScreenUtils.dpTopx(getActivity(),51); //设置图片的宽度
imag1.setLayoutParams(layoutParams9);

猜你喜欢

转载自blog.csdn.net/rfgreeee/article/details/53761795