Cardview Click is not opening Activty

前端 未结 1 434
遇见更好的自我
遇见更好的自我 2021-01-29 09:58

My problems :

  1. no error in this project, i can run successful.

  2. my button can click at a certain time.

  3. when i click it back, it does
1条回答
  •  遥遥无期
    2021-01-29 10:05

    Well You have to First Remove space from this android:foreground="?android:attr/selectableItemBackground" and add this to all the button

    android:clickable="false"

    If you want to Open Activity With Button Then you have to put setOnClickListener to Button .Else if you want to open Activity with Cardview you have to put setOnClickListener to cardview.

    Use this for OnClick Method:

    @Override
        public void onClick(View view) {
            if (view==LoginBtn){
     startActivity(new Intent(this,Login1.class));
            }else if(view==Capture){
    startActivity(new Intent(this,Capture.class));
    
          }
         //Do rest by yourself.
    
        }
    

    0 讨论(0)
提交回复
热议问题