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

你好,有个布局参数问一下你。 #1

Open
chenjiaming2qiqi opened this issue Jul 29, 2017 · 0 comments
Open

你好,有个布局参数问一下你。 #1

chenjiaming2qiqi opened this issue Jul 29, 2017 · 0 comments

Comments

@chenjiaming2qiqi
Copy link

chenjiaming2qiqi commented Jul 29, 2017

    //单列总布局
    likeAll = new LinearLayout(getContext());
    disAll = new LinearLayout(getContext());
    likeAll.setOrientation(VERTICAL);
    disAll.setOrientation(VERTICAL);
    likeAll.setGravity(Gravity.CENTER_HORIZONTAL);
    disAll.setGravity(Gravity.CENTER_HORIZONTAL);
    likeAll.setBackgroundColor(Color.TRANSPARENT);
    disAll.setBackgroundColor(Color.TRANSPARENT);

    //添加文字图片放进一列
    LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,    ViewGroup.LayoutParams.WRAP_CONTENT);
    params.setMargins(0, 10, 0, 0);
    params.gravity = Gravity.CENTER;
    disAll.setGravity(Gravity.CENTER_HORIZONTAL);           //1 
    likeAll.setGravity(Gravity.RIGHT);                                  //2  这两句,为什么重新定义布局?

//编译出来之后的效果,好像对布局没影响?

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