Skip to content

Repository files navigation

🏃BGASwipeItemLayout-Android🏃

License Maven Central

类似 iOS 带弹簧效果的左右滑动控件,可作为 AbsListView 和 RecyclerView 的 item。支持给 BGASwipeItemLayout 和其子控件设置 margin 和 padding 属性

效果图

1-event 2-listview 3-recyclerview

Gradle 依赖

该库已迁移到 AndroidX(minSdk 21),使用方工程需开启 AndroidX(android.useAndroidX=true

dependencies {
    implementation 'cn.bingoogolapple:bga-swipeitemlayout:latestVersion'
}

BGASwipeItemLayout 方法说明

/**
 * 以动画方式打开
 */
public void openWithAnim()

/**
 * 以动画方式关闭
 */
public void closeWithAnim()

/**
 * 直接打开
 */
public void open()

/**
 * 直接关闭。如果在 AbsListView 中删除已经打开的 item 时,请用该方法关闭 item,否则重用 item 时有问题。RecyclerView 中可以用该方法,也可以用 closeWithAnim
 */
public void close()

/**
 * 当前是否为打开状态
 *
 * @return
 */
public boolean isOpened()

/**
 * 当前是否为关闭状态
 *
 * @return
 */
public boolean isClosed()

/**
 * 获取顶部视图
 *
 * @return
 */
public View getTopView()

/**
 * 获取底部视图
 *
 * @return
 */
public View getBottomView()

/**
 * 设置是否可滑动
 *
 * @return
 */
public void setSwipeAble(boolean swipeAble)

BGASwipeItemLayoutDelegate 接口说明

/**
 * 变为打开状态
 *
 * @param swipeItemLayout
 */
void onBGASwipeItemLayoutOpened(BGASwipeItemLayout swipeItemLayout);

/**
 * 变为关闭状态
 *
 * @param swipeItemLayout
 */
void onBGASwipeItemLayoutClosed(BGASwipeItemLayout swipeItemLayout);

/**
 * 从关闭状态切换到正在打开状态
 *
 * @param swipeItemLayout
 */
void onBGASwipeItemLayoutStartOpen(BGASwipeItemLayout swipeItemLayout);

自定义属性说明

属性名 说明 默认值
bga_sil_swipeDirection 往左滑还是往右滑为打开状态(left 或 right) left
bga_sil_bottomMode 底部视图展现方式(layDown 或 pullOut) pullOut
bga_sil_springDistance 弹簧距离 0dp
bga_sil_swipeAble 是否可左右滑动 true

作者联系方式

个人主页 邮箱
bingoogolapple.cn bingoogolapple@gmail.com
个人微信号 微信群 公众号
个人微信号 微信群 公众号
个人 QQ 号 QQ 群
个人 QQ 号 QQ 群

打赏支持作者

如果您觉得 BGA 系列开源库或工具软件帮您节省了大量的开发时间,可以扫描下方的二维码打赏支持。您的支持将鼓励我继续创作,打赏后还可以加我微信免费开通一年 上帝小助手浏览器扩展/插件开发平台 的会员服务

微信 QQ 支付宝
微信 QQ 支付宝

作者项目推荐

License

Copyright 2015 bingoogolapple

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.

About

类似 iOS 带弹簧效果的左右滑动控件,可作为 AbsListView 和 RecyclerView 的 item

Resources

Stars

463 stars

Watchers

19 watching

Forks

Releases

Packages

Contributors

Languages