然而,探探却克服了所有这些问题。或许,这个问题只有积淀过这些知识点的人才能琢磨的透吧。我确实思考了很久,想到了一个还不错的方案。
### 无耻一点
如果我能不要脸一些,我会说这个项目有以下优点:
* 快。真的流畅,滑动的手速再快也赶不上代码刷新view的速度快。
* 高效。仅仅四个卡片view轻松搞定任意多的数据。
* 灵活。自定义ViewGroup对卡片view的高度实现了自适应。
* 细节。卡片之间联动的视觉效果,是像素级的精确。
不信,你下载下来look look。
### 使用方法
#### 1. 在xml文件中引入CardSlidePanel
```xml
```
#### 2. 左右滑动监听
```java
cardSwitchListener = new CardSlidePanel.CardSwitchListener() {
@Override
public void onShow(int index) {
Log.d("Card", "正在显示-" + dataList.get(index).userName);
}
@Override
public void onCardVanish(int index, int type) {
Log.d("Card", "正在消失-" + dataList.get(index).userName + " 消失type=" + type);
}
};
slidePanel.setCardSwitchListener(cardSwitchListener);
```
#### 3. 绑定Adapter
```
…
```
#### 4. 数据更新
```java
// appendDataList
adapter.notifyDataSetChanged();
```
#### Demo安装包
[apk download](CardSlidePanel.apk) (就在thisProj工程之中)
## License
Copyright 2016, xmuSistone
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.