Comments (12)
I was also having this problem. I solved it by adding android:nestedScrollingEnabled="true"
to my ViewPager
.
from viewpagerbottomsheet.
Wrap your ViewPager
with NestedScrollView
:
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v4.view.ViewPager
android:id="@+id/bottom_sheet_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.NestedScrollView>
from viewpagerbottomsheet.
@hynra
this can avoid the exception.
but my listview in ViewPagerBottomSheet can't scroll anymore.
from viewpagerbottomsheet.
Is this reproducible with (corresponding adjustments inside) the example app from this repository?
from viewpagerbottomsheet.
@laenger I'm also getting the same issue. If I use the same layout in the example app it works. However in my app it crashes with this error. If I remove viewpager from my layout the app doesn't crash. However on adding the viewpager it crashes!
I'm trying to integrate your library in Open Food Facts android app.
from viewpagerbottomsheet.
Looking at this again, it seems that #24 fixed this.
from viewpagerbottomsheet.
I tried this fix already before it was merged. It seems to fix the error since we do a null check however the viewpager doesn't scroll anymore. If I try to scroll down the bottom sheet collapses. Maybe I am doing something wrong. Please help!
from viewpagerbottomsheet.
Again, without a minimal reproducible example, it is very difficult to dig deeper into this. It would be great if you could modify the example app such that it runs into the described issue.
from viewpagerbottomsheet.
I was having the same crash and it was because I wasn't adding any fragment to the view pager. Be sure to check that you're adding some fragment to the view pager so it can initiate right
from viewpagerbottomsheet.
I have the same problem and a reprodcution path. You need to use a PagerAdapter instead of a FragmentPagerAdapter to reproduce it.
from viewpagerbottomsheet.
@daniellAlgar This solution is not correct, because of incorrect work of behavior.
I found a better solution for this bug. Try to use ViewPager.post { BottomSheetUtils.setupViewPager(viewPager) }
.
Think it would be helpful. But need to understand how to fix it in lib.
from viewpagerbottomsheet.
For a better understanding, I show you how I use it.
`
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {super.onViewCreated(view, savedInstanceState)
pagerAdapter = StoryBoardStatsFragmentPagerAdapter(activity!!.supportFragmentManager)
if (storyResponse.likedusers.isNotEmpty()) {
pagerAdapter.addFragment(StoryDetailsTabFragment.newInstance(
StoryDetailsTabFragment.TabType.LIKES, storyResponse, this),
storyResponse.likeCount.toString().plus(" likes"))
}
if (storyResponse.viewedusers.isNotEmpty()) {
pagerAdapter.addFragment(StoryDetailsTabFragment.newInstance(
StoryDetailsTabFragment.TabType.VIEWS, storyResponse, this),
storyResponse.viewCount.toString().plus(" views"))
}
viewPager.offscreenPageLimit = 1
viewPager.adapter = pagerAdapter
tabs.setupWithViewPager(viewPager)
}
override fun onDataLoaded() {
viewPager.post {
behavior = ViewPagerBottomSheetBehavior.from(container)
behavior.isHideable = true
behavior.setBottomSheetCallback(object : ViewPagerBottomSheetBehavior.BottomSheetCallback() {
override fun onSlide(bottomSheet: View, slideOffset: Float) {
val percent = slideOffset * 100
if (percent <= 45 && wasExpanded)
behavior.state = ViewPagerBottomSheetBehavior.STATE_HIDDEN
}
override fun onStateChanged(bottomSheet: View, newState: Int) {
if (newState == BottomSheetBehavior.STATE_EXPANDED)
wasExpanded = true
if (newState == BottomSheetBehavior.STATE_HIDDEN)
router.clearStackFragment()
}
})
BottomSheetUtils.setupViewPager(viewPager) {
router.clearStackFragment()
}
}
}`
from viewpagerbottomsheet.
Related Issues (20)
- Add anchor to persistent bottomsheet HOT 1
- Null Pointer Exception HOT 4
- How to display bottom sheet below main toolbar? HOT 1
- Get BottomSheetBehavior callback HOT 3
- crash app after update support library:design to 27.0.2 HOT 8
- Bad Request 400 HOT 1
- It is possible use wrap_content height viewpager? HOT 1
- Issue in ViewPagerUtils HOT 2
- NullPointerException HOT 2
- ANR, While scrolling list with a lot of items
- Failed to resolve: biz.laenger.android:vpbs:0.0.5 HOT 4
- Set Height HOT 1
- migrate to androidx
- java.lang.NullPointerException: at biz.laenger.android.vpbs.ViewPagerBottomSheetBehavior.onInterceptTouchEvent HOT 3
- java.lang.NullPointerException HOT 1
- Used the library and resolved the issue of scrolling.But how to setState of bottomSheet as Expanded on some condition. HOT 2
- can not use vpbs in project with androidx HOT 3
- Cant scroll up the web view inside the view pager HOT 1
- Is this still support viewpager2 ? HOT 2
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 viewpagerbottomsheet.