Shuffle
介绍:
一个易用的 swiping-view。
运行效果:

使用说明:
依赖
compile 'com.meetic.shuffle:shuffle:(last version)'
compile 'com.meetic.dragueur:dragueur:1.0.0'
只需在布局中定义Shuffle
<com.meetic.shuffle.Shuffle
android:id="@+id/shuffle"
android:layout_width="match_parent"
android:layout_height="200dp"
/>
然后用Adapter填充内容
Shuffle shuffle = (Shuffle)findViewById(R.id.shuffle);
shuffle.setShuffleAdapter(new Shuffle.Adapter(){
@Override
public Shuffle.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int type) {
}
@Override
public void onBindViewHolder(final Shuffle.ViewHolder viewHolder, int position) {
}
@Override
public int getItemCount() {
}
});
移动
自由移动

<com.meetic.shuffle.Shuffle
android:id="@+id/shuffle"
android:layout_width="match_parent"
android:layout_height="200dp"
app:shuffle_inlineMove="false"
/>
Inline movements

<com.meetic.shuffle.Shuffle
android:id="@+id/shuffle"
android:layout_width="match_parent"
android:layout_height="200dp"
app:shuffle_inlineMove="true"
/>
方向
如果你想设置成垂直方向(默认是水平)
<com.meetic.shuffle.Shuffle
android:id="@+id/shuffle"
android:layout_width="match_parent"
android:layout_height="200dp"
app:shuffle_vertical="true / false"
/>

旋转
没有旋转
<com.meetic.shuffle.Shuffle
android:id="@+id/shuffle"
android:layout_width="match_parent"
android:layout_height="200dp"
app:shuffle_rotationEnabled="false"
/>

有旋转
<com.meetic.shuffle.Shuffle
android:id="@+id/shuffle"
android:layout_width="match_parent"
android:layout_height="200dp"
app:shuffle_rotationEnabled="false"
app:shuffle_rotation="10"
/>

选项
你可以设置卡片的最大数目以及调整卡片之间的间隙
<com.meetic.shuffle.Shuffle
android:id="@+id/shuffle"
android:layout_width="match_parent"
android:layout_height="200dp"
app:shuffle_numberOfDisplayedCards="4"
app:shuffle_differenceTranslationY="5dp"
app:shuffle_differenceTranslationX="1dp"
/>

Listeners
shuffle.addListener(new Shuffle.Listener() {
@Override
public void onViewChanged(int position) {
}
@Override
public void onScrollStarted() {
}
@Override
public void onScrollFinished() {
}
@Override
public void onViewExited(DraggableView draggableView, Direction direction) {
}
@Override
public void onViewScrolled(DraggableView draggableView, float percentX, float percent) {
}
});
CardDraggableView
<Shuffle
...
//overlay color displayed while scrolling
app:shuffle_colorRight="@color/blue"
app:shuffle_colorLeft="@color/blue"
//overlay content displayed while scrolling (ex: containing logo)
app:shuffle_layoutLeft="@layout/bal_shuffle_cell_left"
app:shuffle_layoutRight="@layout/bal_shuffle_cell_right"
...
/>

动画
所有的动画都可以被重写
shuffle.setViewAnimator(new ShuffleViewAnimator(){
//override methods
});
Try ShuffleViewAnimator and `ShuffleViewAnimatorOnSecondCard
Enable
shuffle.enable(true / false);
已下载
0