Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CENTER CHILD BY DEFAULT (issue) #10

Open
rizwanjillani opened this issue Nov 18, 2019 · 0 comments
Open

CENTER CHILD BY DEFAULT (issue) #10

rizwanjillani opened this issue Nov 18, 2019 · 0 comments

Comments

@rizwanjillani
Copy link

/*
CENTER CHILD BY DEFAULT
*/
@OverRide
public LayoutParams generateLayoutParams(AttributeSet attrs) {
LayoutParams params = new LayoutParams(getContext(), attrs);
params.gravity = Gravity.CENTER;
return params;
}

@Override
protected ViewGroup.LayoutParams generateLayoutParams(@NonNull ViewGroup.LayoutParams p) {
    LayoutParams params = new LayoutParams(p);
    params.gravity = Gravity.CENTER;
    return params;
}

@Override
public LayoutParams generateDefaultLayoutParams() {
    return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.CENTER);
}

@Override
protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
    return p instanceof LayoutParams;
}

it should be dynamic ( can change the gravity according to requirement ). change it if its possible
thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant