If you think the Android project TileView listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.qozix.layouts;
//www.java2s.comimport android.content.Context;
import android.view.View;
import android.view.ViewGroup;
publicclass StaticLayout extends ViewGroup {
public StaticLayout(Context context) {
super(context);
}
@Override
protectedvoid onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
measureChildren(widthMeasureSpec, heightMeasureSpec);
int w = 0;
int h = 0;
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
if (child.getVisibility() != GONE) {
w = Math.max(w, child.getMeasuredWidth());
h = Math.max(h, child.getMeasuredHeight());
}
}
h = Math.max(h, getSuggestedMinimumHeight());
w = Math.max(w, getSuggestedMinimumWidth());
w = resolveSize(w, widthMeasureSpec);
h = resolveSize(h, heightMeasureSpec);
setMeasuredDimension(w, h);
}
@Override
protectedvoid onLayout(boolean changed, int l, int t, int r, int b) {
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
if (child.getVisibility() != GONE) {
child.layout(0, 0, child.getMeasuredWidth(), child.getMeasuredHeight());
}
}
}
}