Android Sliding Up View

不问归期 提交于 2019-11-29 07:54:42

To hide or show panel, you can use

showPanel()

method.

To hide it try this:

SlidingUpPanelLayout slidingPanel = (SlidingUpPanelLayout) findViewById(R.id.sliding_panel); slidingPanel.hidePanel();

To make it appe

SlidingUpPanelLayout slidingPanel = (SlidingUpPanelLayout) findViewById(R.id.sliding_panel); slidingPanel.showPanel();

This is available only in v 2.0 of AndroidSlidingUpPanel (https://github.com/umano/AndroidSlidingUpPanel). As I know, it's included in android support library v13 now, but not sure if there is latest version.

You can check this library for dragging content from all four edges of the screen https://github.com/SimonVT/android-menudrawer

You can make a custom layout inside this menu drawer to get your expected result.

Francesco

You can do it with AndroidSlidingUpPanel, just set visibility:

android:visibility="GONE"

on the 2° child of the view (the panel) and use .showPane() and .hidePane() on SlidingUpPanelLayout to show/hide the panel when you click the button.

The following library do it as well

https://github.com/Paroca72/sc-widgets

Inside you will find a widget named ScSlidingPanel. This widget work different from the other and can be use and customize very easily. You put it inside a RelativeLayout give an alignment and it will open from that side.. Left, Right, Top and Bottom or mixed..

In your specific case your must align your panel at bottom of the container and it will sliding from the bottom.

<!-- Define the container -->
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <!-- Sliding from top -->
    <scapps.com.library.ScSlidingPanel
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true">

            <!-- HERE THE YOUR CONTENT -->
            <!-- or you can load by setLayout method -->

    </scapps.com.library.ScSlidingPanel>

</RelativeLayout>

Another important property that you can use right for your case is the handle size.

You can define an handle and define the beavior of it.. as your image above you used a button.. you can unsing an image and setting setToggleOnTouch() to true for open/close the panel touching on handle.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!