SwipeMenuRecyclerView的使用,侧滑

lisen / 文 发表于2017-09-13 16:46 次阅读

依赖

compile 'com.yanzhenjie:recyclerview-swipe:1.1.2'

布局

</>

activity

.setSwipeMenuCreator();
.setSwipeMenuItemClickListener();
.setLayoutManager(LinearLayoutManager());
.setItemAnimator(DefaultItemAnimator());
.setAdapter();
SwipeMenuCreator = SwipeMenuCreator() {
    onCreateMenu(SwipeMenu swipeMenu, SwipeMenu swipeMenu1, i) {
        width = getResources().getDimensionPixelSize(R.dimen.);

        height = ViewGroup.LayoutParams.;
        SwipeMenuItem addItem;
        addItem = SwipeMenuItem(My_AttentionActivity.)
                .setBackground(R.color.)
                .setText()
                .setTextColor(Color.)
                .setWidth(width)
                .setHeight(height);
        swipeMenu1.addMenuItem(addItem); }
};
SwipeMenuItemClickListener = SwipeMenuItemClickListener() {
    onItemClick(SwipeMenuBridge swipeMenuBridge) {
        swipeMenuBridge.closeMenu();
        direction = swipeMenuBridge.getDirection(); adapterPosition = swipeMenuBridge.getAdapterPosition(); menuPosition = swipeMenuBridge.getPosition(); DialogUtil(My_AttentionActivity.).showConfirmDialog( , ,
                DialogInterface.OnClickListener() {

                    onClick(DialogInterface dialog, which) {
                        .getData(.get().getShopInfo().getShop_id(),.get().getCollect_focus_subscribe_id());
                        dialog.dismiss();
                    }
                },
                DialogInterface.OnClickListener() {

                    onClick(DialogInterface dialog, which) {
                        dialog.dismiss();
                    }

                } );
    }
};


收藏 赞 (0) 踩 (5)