You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
add support for ViewGroups with custom onLayout()
A custom GtkLayoutManager is set to these objects, which calls into the java handlers when measure or layout is requested. Androids onMeasure method is quite different from GTKs measure method, because Android already defines the final size during onMeasure. Therefore, we call onMeasure from GTKs allocate callback instead of the measure callback.
This commit is contained in:
@@ -183,6 +183,19 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
return MeasureSpec.makeMeasureSpec(resultSize, resultMode);
|
||||
}
|
||||
|
||||
protected void measureChildWithMargins(View child,
|
||||
int parentWidthMeasureSpec, int widthUsed,
|
||||
int parentHeightMeasureSpec, int heightUsed) {
|
||||
final MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams();
|
||||
final int childWidthMeasureSpec = getChildMeasureSpec(parentWidthMeasureSpec,
|
||||
/*mPaddingLeft + mPaddingRight +*/ lp.leftMargin + lp.rightMargin
|
||||
+ widthUsed, lp.width);
|
||||
final int childHeightMeasureSpec = getChildMeasureSpec(parentHeightMeasureSpec,
|
||||
/*mPaddingTop + mPaddingBottom +*/ lp.topMargin + lp.bottomMargin
|
||||
+ heightUsed, lp.height);
|
||||
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
|
||||
}
|
||||
|
||||
public static class LayoutParams {
|
||||
public static final int FILL_PARENT = -1;
|
||||
public static final int MATCH_PARENT = -1;
|
||||
|
||||
Reference in New Issue
Block a user