Hi
First time to ask here and generally I find solutions googling but stuck on
this one.
Well, this is my problem :
I have class descendant from ViewGroup that will show only one of its children,
this is the onLayout method :
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
if ((m_SelectedChild == -1) ||
(getChildAt(m_SelectedChild).getVisibility() ==
View.GONE)) {
// Search for the next non GONE view, returns -1 if not
found
m_SelectedChild = searchNextView(m_SelectedChild, true);
if (m_SelectedChild == -1) return;
}
View v = getChildAt(m_SelectedChild);
// calculates the corners of the view using the padding and
margins
Rect corners = getLayoutCorners(v);
v.layout(corners.left, corners.top, corners.right,
corners.bottom);
}
Selecting the current child is done for now by changing the field
m_SelectedChild and calling the requestLayout() method. Doing it will leave the
old selected child laid out. So my question : How can I reset the layout of a
child of the viewgroup ? Or how can I reset the layout of the whole viewgroup ?
Or is there another solution ?
Calling invalidate (after, before or without requestLayout) on the viewgroup or
the old child won't do.
I have an idea to remove all the views and let only the currently selected view
to be the only child of the viewgroup, but I don't think it's a good idea.
Thanks in advance
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en