Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
xiepeijie committed Feb 15, 2017
1 parent becfcc3 commit d451c15
Showing 1 changed file with 40 additions and 29 deletions.
69 changes: 40 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,58 @@ thanks Diolor Swipecards
[SwipeAdapterView](https://github.com/xiepeijie/SwipeAdapterView)

## Usage
### XML配置
### XML
```
<com.lorentzos.flingswipe.SwipeFlingAdapterView
android:id="@+id/swipe_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
swipe:min_adapter_stack="4"
swipe:max_visible="4"
swipe:y_offset_step="28dp"/>
android:id="@+id/swipe_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
swipe:min_adapter_stack="4"
swipe:max_visible="4"
swipe:y_offset_step="28dp"/>
```
### Java Code:
```
swipeView = (SwipeFlingAdapterView) findViewById(R.id.swipe_view);
//swipeView.setIsNeedSwipe(true);// 是否开启swipe滑动效果,当不调用此方法设置时,默认开启。
swipeView.setFlingListener(this);
swipeView.setOnItemClickListener(this);
swipeView.setIsNeedSwipe(true);// 是否开启swipe滑动效果,当不调用此方法设置时,默认开启。
swipeView.setFlingListener(this);
swipeView.setOnItemClickListener(this);
```
onFlingListener
**onFlingListener**
```
@Override
public void removeFirstObjectInAdapter() {
adapter.remove(0);
}
@Override
public void removeFirstObjectInAdapter() {
adapter.remove(0);
}
@Override
public void onLeftCardExit(Object dataObject) {
AppToast.show(this, "swipe left card");
}
@Override
public void onLeftCardExit(Object dataObject) {
// to do something
}
@Override
public void onRightCardExit(Object dataObject) {
AppToast.show(this, "swipe right card");
}
@Override
public void onRightCardExit(Object dataObject) {
// to do something
}
@Override
public void onAdapterAboutToEmpty(int itemsInAdapter) {
if (itemsInAdapter == 3) {
loadData();
}
@Override
public void onAdapterAboutToEmpty(int itemsInAdapter) {
if (itemsInAdapter == 3) {
loadData();
}
}
```

**Click to swipe**

```
@Override
public void onClick(View v) {
// swipe left
swipeView.swipeLeft();
// swipe right
//swipeView.swipeRight();
}
```

# About me
微博:[@萧雾宇](http://weibo.com/payge)

0 comments on commit d451c15

Please sign in to comment.