laenger/ViewPagerBottomSheet
关于
在 Bottom Sheet 中使用 ViewPager!
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- -1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文ViewPagerBottomSheet
Use ViewPagers in Bottom Sheets and Bottom Sheet Dialogs!
Example
This repository features an example app that demonstrates nested ViewPagers inside a bottom sheet:

Use for your project
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.6"
}
Use ViewPagerBottomSheetBehavior for your bottom sheet view:
app:layout_behavior="@string/view_pager_bottom_sheet_behavior"
Setup any nested ViewPager inside the bottom sheet:
BottomSheetUtils.setupViewPager(bottomSheetViewPager)
(This also works when the ViewPager is the bottom sheet view and for further nested ViewPagers)
Use with Bottom Sheet Dialogs
Use ViewPagerBottomSheetDialogFragment as super-class and setup any ViewPager as follows:
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);
ViewPager viewPager = (ViewPager) contentView.findViewById(R.id.viewpager);
// ...
BottomSheetUtils.setupViewPager(viewPager);
dialog.setContentView(contentView);
}
}

How does this work?
ViewPagerBottomSheetBehavior is essentially identical to the original BottomSheetBehavior from the Design Support Library but adds important details: ViewPagers are now properly handled when finding the scrolling child, and this reference can be updated on ViewPager page changes. See the key diff in this commit: 2775715
探索相关项目
加载中…