Closed vishaljadav24 closed 7 years ago
hi @vishaljadav24 , pls show your code and I thought maybe the item width(when horizontal) or height(when vertical) is too large that make the exception you can try like:
YourLinearLayoutManager mLayoutManager = new YourLayoutManager(context, LinearLayoutManager.YourOrientation) {
@Override
protected int getExtraLayoutSpace(State state) {
return youWantPreloadedHeightorWidth;
}
};
I want to display only one card at a time. It is working perfectly for multiple items. How to achieve for one item centered.
I am getting same error if adding this : LinearLayoutManager mLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false) { @Override protected int getExtraLayoutSpace(RecyclerView.State state) { return 30; } };
hi @vishaljadav24 you can compile 'com.android.support:recyclerview-v7:23.4.0', use LinearSnapHelper or RecyclerViewPager instead this library if you needn't item transformer when scroll
and getExtraLayoutSpace
method need return at least one card height if you want to display only one at a time
I have used this. Its demo works fine. When i add card view as items in CircleRecyclerView, its work fine without this line circleRecyclerView.setNeedCenterForce(true);
But i want center card view item event in my project. So i add circleRecyclerView.setNeedCenterForce(true); then its shows error java.lang.NullPointerException: Attempt to invoke virtual method 'float android.view.View.getX()' on a null object reference
I do lots of debug on this. then I find getChildCount() in CircleRecyclerView return null. How to resolve this?