CustomBanner icon indicating copy to clipboard operation
CustomBanner copied to clipboard

banner的点击事件和其中view的点击事件是不是无效了?

Open dongweiq opened this issue 5 years ago • 2 comments

代码如下,其中view的点击事件不能被识别 ` binding.banner.setPages(new CustomBanner.ViewCreator<HomeBean.RobotListBean>() { @Override public View createView(Context context, int i) { View view = LayoutInflater.from(context).inflate(R.layout.item_manager_home_vp, null); return view; }

        @Override
        public void updateUI(Context context, View view, int i, HomeBean.RobotListBean robotListBean) {
            RelativeLayout rlrobot = view.findViewById(R.id.rl_robot);
            rlrobot.setOnClickListener(v -> {
                Intent intent = new Intent(getActivity(), RobotManageActivity.class);
                intent.putExtra("storeId", HttpRequstUtil.storeInfo.getStoreId());
                intent.putExtra("storeName", HttpRequstUtil.storeInfo.getStoreName());
                intent.putExtra("storeImage", HttpRequstUtil.storeInfo.getImageUrl());
                getActivity().startActivity(intent);
            });
            ((TextView) view.findViewById(R.id.tv_robot_name)).setText(robotListBean.getNickname());
            ImageView imageView = ((ImageView) view.findViewById(R.id.iv_vp_header));
            Glide.with(getActivity()).load(robotListBean.getAvatarUrl()).into(imageView);
            ((TextView) view.findViewById(R.id.tv_battery_floor)).setText("所在楼层: " + robotListBean.getCurrentFloor() + "F 电量: " + (int) robotListBean.getPowerPercent() + "%");
            ((TextView) view.findViewById(R.id.tv_status)).setText(Constant.getRobotStatus2String(robotListBean.getTaskStatus()) + "");

        }
    }, robotListBeans);`

dongweiq avatar Mar 18 '20 02:03 dongweiq

可以使用binding.banner.setOnPageClickListener(),但是其中子view的点击事件该如何处理呢?

dongweiq avatar Mar 18 '20 05:03 dongweiq

banner下的子view可以在createView设置监听

donkingliang avatar Mar 18 '20 09:03 donkingliang