Reputation: 401
I am trying to make square child inside RelativeLayout(which I extend). On activity start it works ok, but when ad is loaded, my relative layout gets smaller but my code does not affect child. Code from extended 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();
}
Upvotes: 1
Views: 1804
Reputation: 733
Try to change the values overriding onMeasure method, also in Your code I would either called measure() or requestLayout() by myself
Upvotes: 6