我有以下方法,我希望几个按钮显示图像,其余按钮在单击时应该不可见。无论其他 v.getId() 是什么,我都希望它不可见。
public void onClick(View v) 
        {
            if(v.getId() == R.id.d){
                imgD.setVisibility(View.VISIBLE);
            }else if(v.getId() == R.id.i){
                imgI.setVisibility(View.VISIBLE);
            }else if(v.getId() == R.id.l){
                imgL.setVisibility(View.VISIBLE);
            }else{
                //if other buttons are clicked then the button must be invisible.
            }
        }