Android 判斷Edittext是否有焦點
阿新 • • 發佈:2018-11-19
//判斷Edittext是否有焦點 name.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean b) { if (b){ Login_image_name.setImageDrawable(getResources().getDrawable((R.drawable.name_sel))); Login_image_password.setImageDrawable(getResources().getDrawable(R.drawable.password)); }else{ Login_image_name.setImageDrawable(getResources().getDrawable((R.drawable.name))); Login_image_password.setImageDrawable(getResources().getDrawable(R.drawable.password_sel)); } } });