键盘出现时隐藏ImageView,并在键盘消失时显示
如何在键盘出现时按下某些EditText
后隐藏ImageView
。 然后当键盘被解散时显示这个ImageView
?
我认为OnFocusChangeListener
对你OnFocusChangeListener
可能是正确的。
editText.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
// view/hide ImageView
}
});
edit_Text.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
Toast.makeText(getApplicationContext(), "got the focus", Toast.LENGTH_LONG).show();
// Hide your ImageView
iv.setVisibility(View.GONE); // (make the view gone)
}else
Toast.makeText(getApplicationContext(), "lost the focus", Toast.LENGTH_LONG).show();
// Show your ImageView
iv.setVisibility(View.VISIBLE);
}
});
链接地址: http://www.djcxy.com/p/70077.html
上一篇: Hide ImageView when keyboard appears, and show it when keyboard disappear
下一篇: MAMP Pro Error: The MySQL configuration file my.cnf couldn't be written