Comments (12)
I don't think this is a bug on our end. I can't say for sure from looking at your stacktrace what's wrong with it (I'm able to use recyclerview in a sheet just fine on an internal project).
I would hazard a guess though that it has something to do with SwipeRefreshLayout
, which would almost certainly not work as desired with bottom sheet. Not too familiar with its implementation under the hood, but I could imagine a case where it tries to get a view under a certain x/y position and (perhaps mistakenly) assumes that result is never null. Try removing that wrapper and see if that helps.
from bottomsheet.
You were right! Removing the ScrollView fixed the NullPointerException.
My data to populate the RecyclerView still isn't showing though. I'm fetching it via an Otto event. Do you have any idea why adding BottomSheetLayout would cause this?
from bottomsheet.
I have no idea :/. Could you share a snippet of your fragment_layout file or overview of your view hieararchy? FWIW I had trouble when trying to nest it in a nestedscrollview (Google can't seem to make up their mind on if they support this or not).
from bottomsheet.
Sure! Here's my fragment_layout file:
<com.flipboard.bottomsheet.BottomSheetLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bottomsheet"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linear_layout_base"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.lumivote.lumivote.ui.votes_tab.VotesFragment">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relative_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal"
android:paddingBottom="@dimen/rv_padding">
<TextView
android:id="@+id/leftTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:paddingLeft="@dimen/rv_padding"
android:paddingRight="@dimen/padding_between_main_and_right"
android:paddingTop="@dimen/rv_padding"
android:textSize="@dimen/main_text_size" />
<TextView
android:id="@+id/leftDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@id/leftTitle"
android:paddingLeft="@dimen/rv_padding"
android:paddingRight="@dimen/padding_between_main_and_right"
android:textSize="@dimen/description_text_size"
android:textStyle="italic" />
<TextView
android:id="@+id/mainTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:paddingEnd="@dimen/rv_padding"
android:paddingRight="@dimen/rv_padding"
android:paddingTop="@dimen/rv_padding"
android:textSize="@dimen/main_text_size" />
<TextView
android:id="@+id/mainDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:paddingEnd="@dimen/rv_padding"
android:paddingRight="@dimen/rv_padding"
android:textSize="@dimen/description_text_size" />
</RelativeLayout>
</LinearLayout>
</com.flipboard.bottomsheet.BottomSheetLayout>
Also, I don't know if this is weird but I noticed you graduated from UT last year... I'm from Plano, so I have a lot of friends that go to UT haha
from bottomsheet.
Not weird at all, world needs more Texans :)
So looking at that, nothing stands out to me as an obvious reason why it might not be loading, especially if you're able to get the sheet showing without any problems. My suggested debugging steps would be as follows:
- Breakpoint your adapter and see if the appropriate
onBindViewHolder
andonCreateViewHolder
methods are actually being hit. - Remove the sheet wrapper and see if it still doesn't work
Also, I just realized that you're not trying to put the recyclerview in the sheet, which totally changes things. You can enable interacting with views outside the sheet via BottomSheetLayout#setInterceptContentTouch(boolean)
, then your swipe refresh layout should hopefully work since the sheet won't intercept those touches.. Sorry for the confusion!
from bottomsheet.
Hm, alright, thanks for your help and quick responses anyways. I guess I'll spend the rest of the night figuring this out ๐
Feel free to close the issue since it seems to be a problem on my end
from bottomsheet.
Happy to help. Let me know if disabling the interceptContentTouch flag fixes the initial issue as well
from bottomsheet.
Finally figured it out!!! Issue was having the RecyclerView item layout in the fragment layout itself. I moved it out into a separate file to inflate within onCreateViewHolder()
.
Doing it this way also means the SwipeRefreshLayout
now works without disabling the interceptContent Touch flag
from bottomsheet.
Good to hear, glad you were able to figure it out!
from bottomsheet.
I'll see if I can make some contributions to BottomSheet after I finish my project. This seems like a fun lib to work on
from bottomsheet.
Contributions are always welcome! Take a look at the issue tracker to see some of the implementations we're looking to add in the near future
from bottomsheet.
you use RecyclerView must use a LayoutManager,
such as
LinearLayoutManager layoutManager = new LinearLayoutManager(context); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); mRecyclerView.setLayoutManager(layoutManager);
i meet the same problem and solve the problem .
from bottomsheet.
Related Issues (20)
- find crash
- BottomSheet appears in center of page
- Access Buttons in the Bottomsheet
- how to set different style for different status menu item in MenuSheet
- FloatingActionButton overlaps bottomsheet
- There is no way of knowing if the BottomSheet is dismissing HOT 2
- Efficiency vs Google's standard bottom? HOT 1
- Adding All Social Media
- Any scroll-down-picker won't work with bottom sheet
- Have problems with UnityPlayerActivity
- Rounded Corners HOT 1
- MenuSheetView icon
- Bug in height size after expanded list
- BottomSheetFragment expands by himself when I remove elements from the view.
- The width of the bottomsheet on the flat panel device can not occupy the pan
- Can't build project
- Bug: bottom sheet looks almost non-existing when on landscape HOT 1
- Dialog shadow is not appearing in front of status bar.
- java.lang.NullPointerException RecycyclerView
- XPopup is better๏ผ https://github.com/li-xiaojun/XPopup
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 bottomsheet.