Android ViewPagerBottomSheet Library

Android BottomSheetBehavior with ViewPager support

Лицензия

Лицензия

Категории

Категории

GUI Взаимодействие с пользователем
Группа

Группа

com.github.lizhuogui.android
Идентификатор

Идентификатор

viewpager-bottomsheet
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

aar
Описание

Описание

Android ViewPagerBottomSheet Library
Android BottomSheetBehavior with ViewPager support
Ссылка на сайт

Ссылка на сайт

https://github.com/lizhuogui/ViewPagerBottomSheet
Система контроля версий

Система контроля версий

https://github.com/lizhuogui/ViewPagerBottomSheet

Скачать viewpager-bottomsheet

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.lizhuogui.android/viewpager-bottomsheet/ -->
<dependency>
    <groupId>com.github.lizhuogui.android</groupId>
    <artifactId>viewpager-bottomsheet</artifactId>
    <version>1.0.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.lizhuogui.android/viewpager-bottomsheet/
implementation 'com.github.lizhuogui.android:viewpager-bottomsheet:1.0.0'
// https://jarcasting.com/artifacts/com.github.lizhuogui.android/viewpager-bottomsheet/
implementation ("com.github.lizhuogui.android:viewpager-bottomsheet:1.0.0")
'com.github.lizhuogui.android:viewpager-bottomsheet:aar:1.0.0'
<dependency org="com.github.lizhuogui.android" name="viewpager-bottomsheet" rev="1.0.0">
  <artifact name="viewpager-bottomsheet" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.github.lizhuogui.android', module='viewpager-bottomsheet', version='1.0.0')
)
libraryDependencies += "com.github.lizhuogui.android" % "viewpager-bottomsheet" % "1.0.0"
[com.github.lizhuogui.android/viewpager-bottomsheet "1.0.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
com.google.android.material » material jar 1.0.0

Модули Проекта

Данный проект не имеет модулей.

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:

Example App

Use for your project

AndroidX

dependencies {
    implementation "com.github.lizhuogui.android:viewpager-bottomsheet:1.0.0"
}

support library

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.5"
}

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);
    }
}

Example App

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

Версии библиотеки

Версия
1.0.0