public void adjustChildren(int widthMeasureSpec, int heightMeasureSpec) { if (Log.isLoggable("PercentLayout", 3)) { Log.d( "PercentLayout", "adjustChildren: " + this.mHost + " widthMeasureSpec: " + MeasureSpec.toString(widthMeasureSpec) + " heightMeasureSpec: " + MeasureSpec.toString(heightMeasureSpec)); } int widthHint = MeasureSpec.getSize(widthMeasureSpec); int heightHint = MeasureSpec.getSize(heightMeasureSpec); int i = 0; for (int N = this.mHost.getChildCount(); i < N; ++i) { View view = this.mHost.getChildAt(i); LayoutParams params = view.getLayoutParams(); if (Log.isLoggable("PercentLayout", 3)) { Log.d("PercentLayout", "should adjust " + view + " " + params); } if (params instanceof PercentLayoutHelper.PercentLayoutParams) { PercentLayoutHelper.PercentLayoutInfo info = ((PercentLayoutHelper.PercentLayoutParams) params).getPercentLayoutInfo(); if (Log.isLoggable("PercentLayout", 3)) { Log.d("PercentLayout", "using " + info); } if (info != null) { if (params instanceof MarginLayoutParams) { info.fillMarginLayoutParams((MarginLayoutParams) params, widthHint, heightHint); } else { info.fillLayoutParams(params, widthHint, heightHint); } } } } }