As mentioned by R. Zagórski, I described the reason for this scrolling behavior here, i.e., BottomSheetBehavior
only supports one scrolling child. However this answer wasn't focusing on Bottom Sheet Dialogs.
Therefore – just like R. Zagórski – I extended my own library that overcomes this limitation.
Starting with 0.0.3 there is support for Bottom Sheet Dialogs! You can find the library and the example app here:
https://github.com/laenger/ViewPagerBottomSheet
To use in your project, simply add the maven repo url to your build.gradle:
repositories {
maven { url "https://raw.github.com/laenger/maven-releases/master/releases" }
}
Add the library to the dependencies:
dependencies {
compile "biz.laenger.android:vpbs:0.0.3"
}
Use ViewPagerBottomSheetDialogFragment
as super class for Dialog Fragments. Then setup any ViewPager inside the content view:
public class DialogFragment extends ViewPagerBottomSheetDialogFragment {
@Override
public void setupDialog(Dialog dialog, int style) {
super.setupDialog(dialog, style);
final View contentView = View.inflate(getContext(), R.layout.dialog_bottom_sheet, null);
final ViewPager viewPager = (ViewPager) contentView.findViewById(R.id.viewpager);
// ...
BottomSheetUtils.setupViewPager(viewPager);
dialog.setContentView(contentView);
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…