- Welcome
- Getting started
- Foundations
-
Components
- Accordion
- Alert
- Alignment
- Aria Live
- Autosuggest
- Badge
- Banner Alert
- Bar Chart
- Blockquote
- Bottom Navigation
- Bottom Sheet
- Breadcrumb
- Breakpoint
- Button
- Calendar
- Card
- Card Button
- Carousel
- Checkbox
- Chip
- Code
- Content Cards
- Data Table
- Datepicker
- Description List
- Dialog
- Divider
- Drawer
- Field Set
- Flare
- Flat List
- Flight Leg
- Floating Action Button
- Floating Notification
- Form Label
- Form Validation
- Graphic Promotion
- Horizontal Navigation
- Icon
- Image
- Infinite Scroll
- Link
- List
- Map
- Mobile Scroll Container
- Modal
- Navigation Bar
- Nudger
- Overlay
- Page Indicator
- Pagination
- Panel
- Phone Input
- Picker
- Popover
- Price
- Progress Bar
- Radio Button
- Rating
- Scrollable Calendar
- Section List
- Select
- Skeleton
- Skip Link
- Slider
- Snackbar
- Spinner
- Split Input
- Star Rating
- Switch
- Table
- Text
- Text Input
- Theming
- Ticket
- Toast
- Tooltip
- Touchable Native Feedback
- Touchable Overlay
- Content
- Accessibility
Bottom Sheet
Bottom sheets are views rendered on top of screen content, containing supplementary content that are anchored to the bottom of the screen.
Bottom Sheet
Default
Day | Night |
---|---|
![]() |
![]() |
Installation
Backpack Android is available through Maven Central. Check the main Readme for a complete installation guide.
Usage
The Bottom Sheet component can be used in both XML and Kotlin/Java. In order to work correctly, it needs to be placed inside CoordinatorLayout.
Example of a Bottom Sheet in XML
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- Non-bottom sheet content -->
</FrameLayout>
<net.skyscanner.backpack.bottomsheet.BpkBottomSheet
android:layout_width="match_parent"
android:layout_height="match_parent"
app:behavior_peekHeight="180dp"
app:layout_behavior="net.skyscanner.backpack.bottomsheet.BpkBottomSheetBehaviour">
<!-- Bottom sheet content -->
</net.skyscanner.backpack.bottomsheet.BpkBottomSheet>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Example of a Bottom Sheet in Kotlin
import android.view.View
import android.widget.FrameLayout
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.coordinatorlayout.widget.CoordinatorLayout.*
val root = CoordinatorLayout(context)
val content = FrameLayout(context)
content.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
root.addView(content)
val bottomSheet = BpkBottomSheet(context)
val bottomSheetParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
val bottomSheetBehaviour = BpkBottomSheetBehaviour<BpkBottomSheet>(context)
bottomSheetBehaviour.peekHeight = bottomSheet.resources.getDimensionPixelSize(R.dimen.bpkSpacingXxl)
bottomSheetParams.behavior = bottomSheetBehaviour
bottomSheet.layoutParams = bottomSheetParams
root.addView(bottomSheet)
val bottomSheetContent: View = //... init the bottom sheet content
bottomSheet.addView(bottomSheetContent)
Made with ❤️ by Skyscanner © 2023
© 2023 Skyscanner Backpack. Page last updated on Nov 14, 2022, 09:47