百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

SwipeStack

> 编程语言
开源

一个简单、可自定义且易于使用的 Android 可滑动视图栈。

1.5K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个简单、可自定义且易于使用的 Android 可滑动视图栈。

SwipeStack

A simple, customizable and easy to use swipeable view stack for Android.

QuickStart

Include the Gradle dependency

dependencies {
    compile 'link.fls:swipestack:0.3.0'
}

Use it in your layout file

  1. Use the link.fls.swipestack.SwipeStack view in your XML layout file
  2. Set the parent view's clipChildren attribute to false

Example:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipChildren="false">

    <link.fls.swipestack.SwipeStack
        android:id="@+id/swipeStack"
        android:layout_width="320dp"
        android:layout_height="240dp"
        android:padding="32dp"/>

</FrameLayout>

Create an adapter

Create an adapter which holds the data and creates the views for the stack.

Example:

…

Assign the adapter to the SwipeStack

Last, but not least, assign the adapter to the SwipeStack.

Example:

SwipeStack swipeStack = (SwipeStack) findViewById(R.id.swipeStack);
swipeStack.setAdapter(new SwipeStackAdapter(mData));

That's it!

Callbacks

Currently SwipeStack implements the following callbacks:

  • the SwipeStackListener notifies you when a view was swiped to the left / right or when the stack becomes empty.
  • the SwipeProgressListener notifies you about the progress when the user starts / stops dragging a view around.

Attributes

All attributes are optional.

allowed_swipe_directions specifies the allowed swipe directions. Default: both

animation_duration specifies the duration of the animations. Default: 300ms

stack_size specifies the maximum number of visible views. Default: 3

stack_spacing specifies the vertical distance between two views. Default: 12dp

stack_rotation specifies the maximum random ratation (in degrees) of a card on the stack. Default: 8

swipe_rotation specifies the rotation (in degrees) of the view when it gets swiped left / right. Default: 15

swipe_opacity specifies the opacity of the view when it gets swiped left / right. Default: 1.0

scale_factor specifies the scale factor of the views in the stack. Default: 1.0

disable_hw_acceleration set to true disables hardware acceleration. Default: false

Copyright Notice

Copyright (C) 2016 Frederik Schweiger

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.

GitHub Issues· 57 开放

在 GitHub 查看全部
  • #68

    ViewPager inside adapter

    更新于 2019年7月10日
  • #30

    Alignment of deck of cards as Displayed bellow

    更新于 2019年7月4日
  • #65

    Load Previous Card

    更新于 2018年12月20日
  • #64

    SwipeStack is not Visible

    更新于 2018年11月12日
  • #29

    adapter class not getting called

    更新于 2018年8月7日
  • #61

    Adapter not called for the second time

    更新于 2018年7月25日
  • #52

    getLayoutInflater() does not exist

    更新于 2018年7月25日
  • #66

    How to use recycle view for every swipe card

    更新于 2018年6月21日
  • #63

    Not working with object list

    更新于 2018年5月7日
  • #58

    Question about swipestack child views

    更新于 2018年1月17日

核心特点

  • •Java

> 标签

Java

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言