Android实现淘宝体验的商品列表排序分类点击事件

本文介绍如何利用SlideBottomPanel开源组件在Android应用中实现类似淘宝商品列表的分类排序功能。通过改进原组件,解决了快速点击和背景层监听的问题,提供流畅的用户体验。项目代码托管在GitHub,可直接引入到项目中使用。
摘要由CSDN通过智能技术生成

之前做过一些需求,因为开发周期短,在产品分类的弹窗上一直有一些遗憾,这次又遇到了分类的页面要做,所以花了点时间思考,利用一个开源组件SlideBottomPanel成功实现了一个体验很好的分类功能


网上流传了很多版本的弹窗,但基本都是基于popWindow,Spinner,或者直接覆盖一层Dialog,大多用户必须手点把外层的弹窗点掉,才能选择其他种类的分类放,逼死强迫

症有木有。


捣鼓了一番,效果如下


真正使用效果会非常平滑


废话不多说,Git地址https://github.com/kingideayou/SlideBottomPanel


下载后可以直接把几个java文件复制到自己的项目中,同时记得复制attr参数信息


项目需要Jar包:SmartAndroid


全部弄好,写页面~

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:background="#fff"
    android:orientation="vertical">



    <include layout="@layout/search_tit"></include>

    <com.xuleyuan.sortmenu.view.slidebottompanel.SlideBottomPanel
        android:id="@+id/sbp"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:sbp_panel_height="200dp"
        app:sbp_background_layout="@layout/background_layout"
        app:sbp_title_height_no_display="0dp"
        >
        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:background="#ffffff"
            android:orientation="vertical">
            <ListView
                android:id="@+id/lv_credit_sort"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>
        </FrameLayout>
    </com.xuleyuan.sortmenu.view.slidebottompanel.SlideBottomPanel>

</LinearLayout>

SlideBottomPanel中的一个属性background_layout必须填,这里定义的这个控件所覆盖的页面,可以理解成它本身是一个Framelayout,这个属性定义的是最底层的一个页面

,如果你用其他手段(外部用FrameLayout去做重叠,那么他会强制截取掉你的触摸事件)

我这边简单的做了一个空的页面background_layout,内部是可以任意编辑的,比如在其中加入ScrollView等

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

</LinearLayout>

下面是search_tit页面

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#ffffff"
    android:orientation="horizontal"
    android:grav
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值