Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/HomHomLin/SlidingLayout
实现类似微信WebView的上拉下拉弹跳效果和iOS的ListView的果冻效果。
https://github.com/HomHomLin/SlidingLayout
Last synced: about 1 month ago
JSON representation
实现类似微信WebView的上拉下拉弹跳效果和iOS的ListView的果冻效果。
- Host: GitHub
- URL: https://github.com/HomHomLin/SlidingLayout
- Owner: HomHomLin
- Created: 2016-04-12T05:28:09.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-05-30T01:56:36.000Z (over 8 years ago)
- Last Synced: 2024-08-02T01:23:42.091Z (4 months ago)
- Language: Java
- Homepage: https://github.com/HomHomLin/SlidingLayout
- Size: 4.87 MB
- Stars: 629
- Watchers: 20
- Forks: 126
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
Awesome Lists containing this project
- awesome-github-android-ui - SlidingLayout - 安卓平台View控件 (Sliding)
README
# SlidingLayout
SlidingLayout是一种Android平台的View控件,可以帮助你实现类似微信网页浏览的下拉功能,也可以帮助你实现类似iOS中UITableView的下拉上拉弹跳的果冻效果。
SlidingLayout完美兼容Android自带库和兼容库的所有View组件,包括RecyclerView、ListView、ScrollView以及WebView等等。
SlidingLayout简单易用,最低支持Android api v9。
Project site: .
Demo: .
最新版本:v0.9.0
## 效果图:
![p1](https://raw.githubusercontent.com/HomHomLin/SlidingLayout/master/pic/demo.gif)
![p2](https://raw.githubusercontent.com/HomHomLin/SlidingLayout/master/pic/list.gif)
![p3](https://raw.githubusercontent.com/HomHomLin/SlidingLayout/master/pic/webview.gif)
## 导入项目
**Gradle dependency:**
``` groovy
compile 'homhomlin.lib:sldinglayout:0.9.0'
```or
**Maven dependency:**
``` xmlhomhomlin.lib
sldinglayout
0.9.0```
**依赖:**
如果你的项目需要支持API V9,你需要添加以下依赖:
``` groovy
compile 'com.nineoldandroids:library:2.4.0'
```## 用法
SlidingLayout的使用非常简单,你只需要将你想实现的控件在XML布局中嵌套进SlidingLayout即可,如你需要让ListView实现果冻效果:
### 1.创建背景View的xml
``` xml
```
### 2.将你的控件放进SlidingLayout中
注意布局需要res-auto命名空间,注意将自己的控件设置一个背景,否则会将背景View透视出来。
```xml
```
### 3.没有第三步啦!
运行即可看到效果!具体其他的内容可以看Demo。
## XML样式参数
* `background_view` 背景view
* `sliding_mode` 滑动模式,both为上下可弹跳,top为顶部弹跳,bottom为底部弹跳,默认为both
* `sliding_pointer_mode` 手指模式,one为只识别一个手指,more为支持多指滑动,默认为more
* `top_max` 当滑动模式为top时才有效,用于可滑动的最大距离,如"top_max:200dp",默认为-1(不限制)## 常用API
* `public void setSlidingOffset(float slidingOffset)` 设置控件的滑动阻力,有效值为0.1F~1.0F,值越小阻力越大,默认为0.5F
* `public void setTargetView(View view)` 设置控件的前景View
* `public void setBackgroundView(View view)` 设置控件的背景View
* `public void setSlidingListener(SlidingListener slidingListener)` 给控件设置监听,可以监听滑动情况
* `public void setSlidingMode(int mode)` 设置滑动模式
* `public void setSlidingDistance(int max)` 设置最大滑动距离,仅在top模式下有效## Developed By
* Linhonghong -
## License
Copyright 2016 LinHongHongLicensed 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 athttp://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.