-1
日增长
9,433
stars
2,218
forks
341
watchers
169
prs
830
issues
8
releases
README
Note: we are not actively responding to issues right now. If you find a bug, please submit a PR.
Android Sliding Up Panel
=========================
This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application.
As seen in Umano Android App (now acquired by Dropbox):
!SlidingUpPanelLayout
Known Uses in Popular Apps
[Soundcloud] (https://play.google.com/store/apps/details?id=com.soundcloud.android)
[Dropbox Paper] (https://play.google.com/store/apps/details?id=com.dropbox.paper)
[Snaptee] (https://play.google.com/store/apps/details?id=co.snaptee.android)
If you are using the library and you would like to have your app listed, simply let us know.
Importing the Library
Simply add the following dependency to your build.gradle file to use the latest version:
groovy
dependencies {
repositories {
mavenCentral()
}
compile 'com.sothree.slidinguppanel:library:3.4.0'
}
Usage
Include com.sothree.slidinguppanel.SlidingUpPanelLayout as the root element in your activity layout.
The layout must have gravity set to either top or bottom.
Make sure that it has two children. The first child is your main layout. The second child is your layout for the sliding up panel.
The main layout should have the width and the height set to match_parent.
The sliding layout should have the width set to match_parent and the height set to either match_parent, wrap_content or the max desireable height. If you would like to define the height as the percetange of the screen, set it to match_parent and also define a layout_weight attribute for the sliding view.
By default, the whole panel will act as a drag region and will intercept clicks and drag events. You can restrict the drag area to a specific view by using the setDragView method or umanoDragView attribute.
For more information, please refer to the sample code.
xml
For smooth interaction with the ActionBar, make sure that windowActionBarOverlay is set to true in your styles:
xml
true
However, in this case you would likely want to add a top margin to your main layout of ?android:attr/actionBarSize
or ?attr/actionBarSize to support older API versions.
Caveats, Additional Features and Customization
If you are using a custom umanoDragView, the panel will pass through the click events to the main layout. Make your second layout clickable to prevent this.
You can change the panel height by using the setPanelHeight method or umanoPanelHeight attribute.
If you would like to hide the shadow above the sliding panel, set shadowHeight attribute to 0.
Use setEnabled(false) to completely disable the sliding panel (including touch and programmatic sliding)
Use setTouchEnabled(false) to disables panel's touch responsiveness (drag and click), you can still control the panel programatically
Use getPanelState to get the current panel state
Use setPanelState to set the current panel state
Top issues
#525Panel glitching and stopping in the middle every so often20 comments · 2015-08-12#468Compatibility with the new Support Design class "CoordinatorLayout"14 comments · 2015-06-02#873unable to scroll RecyclerView till the end if panel is anchored10 comments · 2017-10-03#921When Building against API 28, Proguard Error is observed9 comments · 2018-07-04#705Binary XML file line #8: Error inflating class com.sothree.slidinguppanel.SlidingUpPanelLayout9 comments · 2016-04-19#798Scrollvew scroll to the top of face board of the Lord would happen quickly drag down8 comments · 2016-12-29#284Feature Request: Allow to slide up the panel by swiping above it.8 comments · 2014-10-17#876Double tap hangs the view7 comments · 2017-10-11
Latest release
AndroidSlidingUpPanel v3.3.0 3.3.0 2016-03-07Allow to provide a FadeOnClickListener. Bug fixes.