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

使用GalleryLayoutManager之后item显示不出来 #16

Open
tx123456 opened this issue Apr 19, 2018 · 5 comments
Open

使用GalleryLayoutManager之后item显示不出来 #16

tx123456 opened this issue Apr 19, 2018 · 5 comments

Comments

@tx123456
Copy link

这是我的代码
List lisr = new ArrayList<>();
for (int i = 0; i <20 ; i++) {
lisr.add("item"+i);
}
adapter = new NoticeBannerAdapter(lisr);
new GalleryLayoutManager(GalleryLayoutManager.HORIZONTAL).attach(recycleBanner);
recycleBanner.setAdapter(adapter);

下面是打印出来的日志

D/GalleryLayoutManager: onLayoutChildren() called with: state = [State{mTargetPosition=-1, mData=null, mItemCount=20, mIsMeasuring=false, mPreviousLayoutItemCount=0, mDeletedInvisibleItemCountSincePreviousLayout=0, mStructureChanged=true, mInPreLayout=false, mRunSimpleAnimations=false, mRunPredictiveAnimations=false}]
reset:
D/GalleryLayoutManager: firstFillCover finish:first: 0,last:0
V/GalleryLayoutManager: onScrolled: dx:0,dy:0
onScrolled: dx:0,dy:0
D/GalleryLayoutManager: onLayoutChildren() called with: state = [State{mTargetPosition=-1, mData=null, mItemCount=20, mIsMeasuring=false, mPreviousLayoutItemCount=20, mDeletedInvisibleItemCountSincePreviousLayout=0, mStructureChanged=false, mInPreLayout=false, mRunSimpleAnimations=false, mRunPredictiveAnimations=false}]
onLayoutChildren: ignore extra layout step
D/OpenGLRenderer: endAllActiveAnimators on 0x7f7c70c000 (RippleDrawable) with handle 0x7f7decc840

请问下我是不是哪里写的有点问题,我把这些代码复制到一个新开的项目,能显示,然后在自己项目中引用就显示不出来,我看打印出来的日志mItemCount是有20条的。

@VliceZ
Copy link

VliceZ commented Oct 17, 2018

我也遇到这个问题,请问解决了吗

@tx123456
Copy link
Author

@VliceZ 我记得这个问题好像是因为高度设置的warp-content导致的,给他设置一个高度就好了

@VliceZ
Copy link

VliceZ commented Oct 17, 2018

@tx123456 根布局有设置固定高度,但还是显示不出item。

@tx123456
Copy link
Author

@VliceZ 你的recycleView设置了高度没有

@VliceZ
Copy link

VliceZ commented Oct 17, 2018

@tx123456 recycleView设置了固定高度解决了,非常感谢! @BCsl 希望能够说明一下避免更多人踩坑

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