• Stars
    star
    811
  • Rank 56,215 (Top 2 %)
  • Language
    Java
  • Created over 9 years ago
  • Updated about 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

底部划动菜单,滑动时背景图透明度渐变,支持嵌套 ListView 或 ScrollView

SlideBottomPanel SlideBottomPanel

底部划出视图,轻松实现「知乎日报β版」效果(效果见底部效果图)
可以划出的视图可以包裹 ListView 及 ScrollView。并且 ListView 及 ScrollView 可以在第二级或第三级视图中。
Demo apk 下载地址:SlideBottomPanelDemo 下载

ListView 效果

推荐使用 Android Support Library 23.2 提供的 BottomSheet

了解更多:Android Support Library 23.2
如何使用:Teach you how to use Design Support Library: Bottom Sheets

更新日志

  • 1.0.6 版本:添加了 displayPanel() 方法,直接控制视图显示
  • 1.0.3 版本修复了多重嵌套时,隐藏 PanelTitle 时 Panel 出现跳动的 Bug

How to use 如何使用

###导入项目

Gradle
  compile 'com.github.kingideayou:SlideBottomPanel:1.0.6'
Import

首先下载 SlideBottomPanel,将 SlideBottomPanel 文件夹拷贝到项目的目录下面,然后在setting.gradle文件中增加文件夹名称

  include ":SlideBottomPanel"

然后在我们需要依赖这个模块的module中的build.gradle文件中加入如下代码:

  compile project(':SlideBottomPanel')

布局文件

导入成功后,只需要在 XML 文件中添加如下视图(层级比较简单 FrameLayout 的子视图直接包含 ListView 或者 ScrollView)
下面布局只作简单演示,复杂效果请看 Demo.

  <!-- sbp_hide_panel_title 为滑动过程中及子视图显示是是否需要隐藏标题,默认显示(目前只支持 FrameLayout) -->
  <!-- background_layout 为首页显示在滑块底部的视图(下面的示例图中的 WebView) -->
  <me.next.slidebottompanel.SlideBottomPanel
    android:id="@+id/sbv"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:sbp_title_height_no_display="55dp"
    app:sbp_panel_height="380dp"
    app:sbp_hide_panel_title="true"
    app:sbp_background_layout="@layout/background_layout">


    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="380dp"
        android:background="#ffffff"
        android:orientation="vertical">

        <ListView
            android:id="@+id/list_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
            
        <!-- 标题,如果需要完整显示标题,设置 sbp_title_height_no_display="标题的高度" -->
        <TextView
            android:layout_width="match_parent"
            android:layout_height="55dp"
            text="我是标题"
            android:orientation="horizontal"
            android:gravity="center_vertical"
            android:paddingLeft="@dimen/activity_horizontal_margin"
            android:paddingRight="@dimen/activity_horizontal_margin"
            android:background="#ffffff"/>

    </FrameLayout>

</me.next.slidebottompanel.SlideBottomPanel>

同时也支持复杂一点的效果(知乎日报β版),子视图 FrameLayout 中包含 ViewGroup,ViewGroup 包含 ListView 或 ScrollView

<me.next.slidebottompanel.SlideBottomPanel
    android:id="@+id/sbv"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:sbp_hide_panel_title="true"
    app:sbp_title_height_no_display="55dp"
    app:sbp_panel_height="380dp"
    app:sbp_background_layout="@layout/background_layout">
  
  
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="380dp"
        android:background="#ffffff"
        android:orientation="vertical">

        <LinearLayout
            android:weightSum="9"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
            
            <ListView
                android:id="@+id/list_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="8"/>
            
            <TextView
                android:id="@+id/tv_edit"
                android:layout_weight="1"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_gravity="center_vertical"
                android:gravity="center_vertical"
                android:layout_marginLeft="@dimen/activity_horizontal_margin"
                android:text="写点评..."/>

        </LinearLayout>
    </FrameLayout>
    
    <TextView
        android:layout_width="match_parent"
        android:layout_height="55dp"
        text="我是标题"
        android:orientation="horizontal"
        android:gravity="center_vertical"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:background="#ffffff"/>

</me.next.slidebottompanel.SlideBottomPanel>

代码控制

完成布局文件后,在 Activity 中将对应的视图填充即可。

  //隐藏 SlideBottomPanel
    if (sbv.isPanelShowing()) {
        sbv.hide();
    }


  //显示 SlideBottomPanel
  sbv.displayPanel()

效果图

SlideBottomPanel

SlideBottomPanel

动图展示:

知乎效果

ListView 效果

鸣谢

此项目的完成要感谢 MultiCardMenu

License

Copyright 2015 NeXT

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

TagCloudView

支持 SingleLine 模式的标签云效果
Java
870
star
2

UCE-Handler

调试时捕获程序崩溃,可提供崩溃的类名、方法名、行数、Error Log、Activity 路径、设备信息、应用信息...
Java
53
star
3

PagerSlidingTabStripPro

A powerful library from PageSlidingTabStrip
Java
27
star
4

RadarView

A custom view looks like a searching radar.
Java
23
star
5

MarkwonCodeEx

Markwon extensition support elegant code background. 为 Markwon 提供优雅的代码块显示
Kotlin
22
star
6

Android_M_Permission

android m permission demo
Java
9
star
7

CaptureView

屏幕选区视图
Java
7
star
8

ClipboardLinkDetect

获取剪贴板 url 并通过 url 获取网页标题
Java
5
star
9

EditTextPlus

Java
5
star
10

ScreenShotDemo

Android Screenshot without StatusBar Demo.
Java
5
star
11

NinePicView

支持自定义单图尺寸,「长图」、「Gif」 标记的九宫格视图
Java
4
star
12

ParabolaEmojiRain

Java
4
star
13

ZXingPro

识别图片二维码&生成二维码图片。Decode barcode image & Generate barcode image.
Java
3
star
14

Juejin-Alfred-Workflow

An Alfred Workflow for juejin.im
Python
3
star
15

AndroidSDKSearchAlfred

A Alfred extension that adds an 'asdk' command and view source links for the Android SDK.
Python
3
star
16

FeidianElectron

掘金沸点 Mac、Windows 客户端(非官方)
JavaScript
3
star
17

ShareBottomSheet

Java
2
star
18

bilibilitvapk

1
star
19

RainbowRecyclerView

Java
1
star
20

GoldDemoProject

Java
1
star
21

LinkageViewPager

A linkage ViewPager.(联动的 ViewPager)
Java
1
star
22

ViewPagerNested

Java
1
star
23

NestedScrollViewDemo

Java
1
star
24

AddToCart

a animation for "add to cart"
Java
1
star
25

kingideayou.github.io

博客
HTML
1
star
26

WebViewLongScreenShot

Java
1
star
27

LeanCloudJSDemo

HTML
1
star
28

EmoticonKeyboard

Java
1
star