1. 程式人生 > >瀑布流實現京東分類聯動點選長按效果

瀑布流實現京東分類聯動點選長按效果

1.首先,導依賴

implementation'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30'

2.在包裡配置

allprojects {
    repositories {
        google()
        jcenter()
        **maven { url "https://jitpack.io" }**
    }
}

瀑布流點選事件

//單擊
ada.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
                @Override
                public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                    Toast.makeText(getActivity(),"啦啦啦",+0).show();
                }
            });
 //長按
ada.setOnItemLongClickListener(new BaseQuickAdapter.OnItemLongClickListener() {
                @Override
                public boolean onItemLongClick(BaseQuickAdapter adapter, View view, int position) {
                    list.remove(position);
                    ada.notifyDataSetChanged();
                    return false;
                }
            });

在這裡插入圖片描述