Pre-ICS, the size of a dialog was wrapped around it's body View. On
ICS this is no longer the case, but it appears to be a fixed size. Is
there a way to force the WRAP_CONTENT clearly?
dialog.getWindow().setLayout(LayoutParams.WRAP_CONTENT),
LayoutParams.WRAP_CONTENT);
What works is this terrible hacky code, but I couldn't come up with a
better solution:
ViewParent parent = bodyView.getParent();
if (parent != null) {
parent = parent.getParent();
if (parent != null) {
parent = parent.getParent();
if ((parent != null) && (parent instanceof ViewGroup)) {
LayoutParams layoutParams =
((View)parent).getLayoutParams();
if (layoutParams instanceof FrameLayout.LayoutParams) {
layoutParams.width =
ViewGroup.LayoutParams.WRAP_CONTENT;
((FrameLayout.LayoutParams)layoutParams).gravity =
Gravity.CENTER_HORIZONTAL;
((View)parent).setLayoutParams(layoutParams);
}
}
}
}
--
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