mAdapter.addHeaderView(headerView) val userInfo = MyAppContext.getInstance().userInfo ?: return ImageLoaderProxy.getInstance().display( if (userInfo.avatarUrl == null) "" else userInfo.avatarUrl, headerView.avatarImg, DefaultImageUtil.getDefaultAvatarResId(userInfo.nickname)) //val noLoginAction = View.OnClickListener { startActivity(Intent(activity, NewLoginActivity::class.java)) } /*val noLoginAction = object : View.OnClickListener { override fun onClick(v: View?) { startActivity(Intent(activity, NewLoginActivity::class.java)) } }*/ headerView.goalsTv.setOnClickListener { startActivity(Intent(activity, SelectProjectAct::class.java)) } headerView.goalsTipTv.setOnClickListener(this) headerView.couponTv.setOnClickListener(this) headerView.couponTipTv.setOnClickListener(this) headerView.remainTv.setOnClickListener(this) headerView.walletTv.setOnClickListener(this) if (mIsLogin) { headerView.goto_login_btn.visibility = View.GONE headerView.userInfoLl.visibility = View.VISIBLE headerView.nameTv.text = userInfo.nickname headerView.projectTv.text = MyAppContext.getInstance().mainProjectName } else { headerView.goto_login_btn.visibility = View.VISIBLE headerView.userInfoLl.visibility = View.INVISIBLE } 找了半天,发现headerView 可以显示出来,但是放到方法外边去又显示不出来。就是放在前边一点的地方可以显示,后边就不能显示了,仔细看发现, 原来是这个不起眼的地方,使得程序后边没有执行了。然后监听就没有执行,没有设置监听。慎用return 语句!!!!!!!!!!!!!!!!!!!!!!!!
kotlin点击事件监听无效
最新推荐文章于 2024-05-12 12:21:16 发布