mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-04-28 12:17:57 +03:00
ViewGroup: Fix margin layout
This commit is contained in:
parent
f1e964ac36
commit
2e2a3c889c
1 changed files with 14 additions and 4 deletions
|
@ -454,10 +454,20 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
|||
public MarginLayoutParams(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
TypedArray a = context.obtainStyledAttributes(attributeSet, R.styleable.ViewGroup_MarginLayout);
|
||||
leftMargin = a.getDimensionPixelSize(R.styleable.ViewGroup_MarginLayout_layout_marginLeft, 0);
|
||||
topMargin = a.getDimensionPixelSize(R.styleable.ViewGroup_MarginLayout_layout_marginTop, 0);
|
||||
rightMargin = a.getDimensionPixelSize(R.styleable.ViewGroup_MarginLayout_layout_marginRight, 0);
|
||||
bottomMargin = a.getDimensionPixelSize(R.styleable.ViewGroup_MarginLayout_layout_marginBottom, 0);
|
||||
int margin = a.getDimensionPixelSize(com.android.internal.R.styleable.ViewGroup_MarginLayout_layout_margin, -1);
|
||||
|
||||
if (margin >= 0) {
|
||||
leftMargin = margin;
|
||||
topMargin = margin;
|
||||
rightMargin= margin;
|
||||
bottomMargin = margin;
|
||||
} else {
|
||||
leftMargin = a.getDimensionPixelSize(R.styleable.ViewGroup_MarginLayout_layout_marginLeft,0);
|
||||
rightMargin = a.getDimensionPixelSize(R.styleable.ViewGroup_MarginLayout_layout_marginRight,0);
|
||||
topMargin = a.getDimensionPixelSize(R.styleable.ViewGroup_MarginLayout_layout_marginTop,0);
|
||||
bottomMargin = a.getDimensionPixelSize(R.styleable.ViewGroup_MarginLayout_layout_marginBottom,0);
|
||||
}
|
||||
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue