我有一个 FrameLayout 并想在彼此之上添加 2 个 ImageView。这是我的代码
FrameLayout.LayoutParams ImageViewParams = new
FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, param_height);
ImageView mImageView = new ImageView(getActivity());
mImageView.setScaleType(ScaleType.FIT_CENTER);
mImageView.setImageResource(mImageArray[counter]);
mImageView.setLayoutParams(ImageViewParams);
ImageView mImageView2 = new ImageView(getActivity());
mImageView2.setBackgroundResource(mImageArray[counter]);
mImageView2.setScaleType(ScaleType.FIT_CENTER);
mImageView2.setLayoutParams(ImageViewParams);
FrameLayout mFrameLayout = new FrameLayout(getActivity());
mFrameLayout.addView(mImageView);
if(counter != 0)
mFrameLayout.addView(mImageView2);
mImageView2 被拉伸。似乎“scaleType”被忽略了?FrameLayout 位于 TableLayout 中。TableLayout 在 for 循环中填充...