1 int width = ScreenUtils.getScreenWidth(this);
2 int height = ScreenUtils.getScreenHeight(this);
3 mImageView = new ImageView(this);
4 mImageView.setScaleType(ImageView.ScaleType.FIT_XY);
5 mImageView.setLayoutParams(new Gallery.LayoutParams(width, height));// 设置Gallery组件的背景风格
1 ViewGroup.LayoutParams params = mImageView.getLayoutParams();
2 //设置图片的相对于屏幕的宽高比
3 params.width = width;
4 params.height = height;
5 mImageView.setLayoutParams(params);

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
  • 2022-02-18
  • 2021-06-08
  • 2022-12-23
  • 2021-09-25
  • 2022-12-23
猜你喜欢
  • 2021-05-16
  • 2021-07-18
  • 2023-03-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案