0
我有一個FrameLayout,並希望添加2個ImageViews在彼此之上。 這是我的代碼Android:似乎「scaletype」被忽略,當多添加一個ImageView到一個FrameLayout?
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循環中...