我想在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();
}
Run Code Online (Sandbox Code Playgroud) android ×1