SlideBottomPanel 底部划出视图

2,642 阅读1分钟

SlideBottomPanel SlideBottomPanel

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

ListView 效果

更新日志

  • 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.

  
  
  


    

        

        
        

    


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




    

        

            

            

        
    

    


代码控制

完成布局文件后,在 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.