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

ItemView宽度为0的问题 #355

Open
androidWht opened this issue Oct 11, 2019 · 2 comments
Open

ItemView宽度为0的问题 #355

androidWht opened this issue Oct 11, 2019 · 2 comments

Comments

@androidWht
Copy link

image
image

@liuan3756
Copy link

我直接new一个ConvenientBanner,然后addview到布局中也是会这样,item的宽度都是0,但是高度有值。如果直接在xml中写的话就不会。

@liuan3756
Copy link

 convenientBanner.setPages(new CBViewHolderCreator()
        {
            @Override
            public ImageHolderView createHolder(View itemView)
            {
                ViewGroup.LayoutParams layoutParams = itemView.getLayoutParams();
                layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
                return new ImageHolderView(itemView);
            }

            @Override
            public int getLayoutId()
            {
                return R.layout.item_banner;
            }
        }, strings);

这样我试了是可以的 宽度正常了

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

2 participants