# StretchPanel
**Repository Path**: zyz1111/StretchPanel
## Basic Information
- **Project Name**: StretchPanel
- **Description**: StretchPanel可以根据需要收缩或者展开视图的控件,使用简单方便!
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 3
- **Created**: 2015-08-28
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
#StretchPanel
最近在工作中要用到的效果,干脆写了一个自定义的控件。
控件很简单,是个上下部分的视图,下半部分可以根据需求收缩或者展开,过程中有动画,提升用户的使用体验。
#How to use
-1.首先是xml的配置
```xml
```
或者
```xml
```
-2.在界面初始化代码中添加:
```java
// xml中没有指定相关视图id的话,需要代码添加
final StretchPanel panel = (StretchPanel) findViewById(R.id.stretchPanel);
final View contentView = View.inflate(this, R.layout.view_content, null);
final View stretchView = View.inflate(this, R.layout.view_stretch, null);
panel.setStretchView(stretchView);
panel.setContentView(contentView);
panel.setStretchAnimationDuration(200);
panel.setHandleClikeEventOnThis(contentView);//点击事件可以调用该方法或者完全自己实现
```
```java
// xml中指定了id的话
final StretchPanel panel = (StretchPanel) findViewById(R.id.stretchPanel);
panel.setHandleClikeEventOnThis(panel.getContentView())
```
PS:demo中在listview中使用该控件时,由于没有管理item开关的状态,因此在view重用时状态会出现问题!!!
有问题或者建议可以发送邮件到flytopc@hotmail.com