Comments (6)
It looks like your adapter is providing views without layout parameters. Whilst I prefer this to not be the case, I agree that it is a bug for the library to crash on it.
from superslim.
Just a quick observation - I was also getting this exception, even when my views had layout params set. Turned out the problem is that my layoutParams.sectionFirstPosition in my views were incorrect - I was setting it to the index of the first (non-header) item in the section, when it's supposed to be the position of the section header itself.
from superslim.
I'm also getting this error in case if there is single item in the list
from superslim.
This is a problem with the scroll indicator computation, which has been removed for now as it is bad, inaccurate, and will be wholly replaced after the section layout manager design changes.
from superslim.
i encounter the similar problem:
java.lang.NullPointerException: Attempt to read from field 'int android.view.ViewGroup$LayoutParams.width' on a null object reference
at android.view.ViewGroup$LayoutParams.(ViewGroup.java:6403)
at android.view.ViewGroup$MarginLayoutParams.(ViewGroup.java:6685)
at android.support.v7.widget.RecyclerView$LayoutParams.(RecyclerView.java:7420)
at com.tonicartos.superslim.LayoutManager$LayoutParams.(LayoutManager.java:1819)
at com.tonicartos.superslim.GridSLM$LayoutParams.(GridSLM.java:506)
at com.tonicartos.superslim.GridSLM$LayoutParams.from(GridSLM.java:520)
at com.zihexin.cwapp.activity.CityActivity$CountryAdapter.onBindViewHolder(CityActivity.java:111)
at com.zihexin.cwapp.activity.CityActivity$CountryAdapter.onBindViewHolder(CityActivity.java:70)
at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:4402)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:3717)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:3609)
at com.tonicartos.superslim.LayoutState.getView(LayoutState.java:44)
at com.tonicartos.superslim.LayoutManager.layoutChildren(LayoutManager.java:1316)
at com.tonicartos.superslim.LayoutManager.onLayoutChildren(LayoutManager.java:264)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2118)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:2415)
at android.view.View.layout(View.java:15596)
at android.view.ViewGroup.layout(ViewGroup.java:4966)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
at android.view.View.layout(View.java:15596)
at android.view.ViewGroup.layout(ViewGroup.java:4966)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:15596)
at android.view.ViewGroup.layout(ViewGroup.java:4966)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
at android.view.View.layout(View.java:15596)
at android.view.ViewGroup.layout(ViewGroup.java:4966)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:15596)
at android.view.ViewGroup.layout(ViewGroup.java:4966)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
at android.view.View.layout(View.java:15596)
at android.view.ViewGroup.layout(ViewGroup.java:4966)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:15596)
at android.view.ViewGroup.layout(ViewGroup.java:4966)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2072)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1829)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:550)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.M
and i think i solve it
in onCreateViewHolder method, i use View.inflate(mContext,R.layout.item_country_content,null); before to get the itemView,and then i got the problem,finally,i change to this:
view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_country_content, viewGroup, false); and problem solved
just write here to help others
from superslim.
@jesielin What you encountered is a bug. The configuration you had should had caused the layout manager to assign sensible default layout parameters to the item. This bug will be tracked in #74.
from superslim.
Related Issues (20)
- Flexbox layout
- Dynamic sticky content
- Built in elevation change for sticky content.
- Infinite scroll
- Collapsible/expandable sections
- Sticky footers weirdly wobble on horizontal scroll. HOT 1
- Toggling collapsible sections loses items.
- Prepare milestone 5 release
- Update Readme.md
- On layout a sticky footer always sits above sticky inset (section state inset parameter).
- Sticky footer HOT 2
- RecycleView scrolls over sticky header
- Crash On RecyclerView Refresh
- Does SuperSLiM supports sub headers ? HOT 10
- Mocking framework
- i cannot build the project
- NPE at LayoutManager#onItemsUpdated
- Androidx HOT 1
- Is this covered by the Apache 2.0 License?
- Scrolling issue with Sticky Headers on
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from superslim.