我正在尝试在RelativeLayout(我扩展)中制作方形孩子。在活动开始时它工作正常,但是当加载广告时,我的相对布局变小但我的代码不会影响孩子。来自扩展的 RelativeLayout 的代码:
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
int minSize = Math.min(w, h);
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) imageViewContainer.getLayoutParams();
layoutParams.width = minSize;
layoutParams.height = minSize;
imageViewContainer.setLayoutParams(layoutParams);
invalidate();
}