Android 有人能帮忙解决这个错误吗?

Android 有人能帮忙解决这个错误吗?,android,android-studio,Android,Android Studio,错误为“不兼容类型”(注释如下)。请帮助解决这个问题。目前正在使用android studio 1.1.0 public void onClick(View view) { switch (view){ case R.id.ETbutton: //ERROR: incompatible types

错误为“不兼容类型”(注释如下)。请帮助解决这个问题。目前正在使用android studio 1.1.0

 public void onClick(View view) {                            
            switch (view){
                case R.id.ETbutton:                                //ERROR: incompatible types
                    String gur = ET.getText().toString();           
                    if (gur.contentEquals("left")) {
                        tv.setGravity(Gravity.LEFT);                
                    } else if (gur.contentEquals("center")) {
                        tv.setGravity(Gravity.CENTER);
                    } else if (gur.contentEquals("right")) {
                        tv.setGravity(Gravity.RIGHT);
                    } else if (gur.contains("WTF")) {
                        tv.setText("Where's the Fridge?? ");
                        Random rand = new Random();
                        tv.setTextColor(Color.argb(40, rand.nextInt(265), rand.nextInt(266), rand.nextInt(267)));   //Tansparency, and rest colors
                        tv.setTextSize(rand.nextInt(100));                      
                    }
                    break;

                case R.id.toggleButton:                                           //ERROR: incompatible types
                    if(TB.isChecked()){
                        ET.setInputType(InputType.TYPE_CLASS_TEXT);                                 
                    }else{
                        ET.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
                    }
                    break;
            }
        }
switch()
需要一个整数。您正在向其传递一个视图

这个

一定是

switch(view.getId()) // CORRECT: The View id is an integer

R.id.ETbutton应为view类型
switch(view.getId()) // CORRECT: The View id is an integer