键盘出现时如何隐藏ImageView
(按下某些EditText
后)。
然后在解除键盘时显示此ImageView
?
答案 0 :(得分:3)
我认为OnFocusChangeListener
对你来说可能是正确的。
editText.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
// view/hide ImageView
}
});
答案 1 :(得分:3)
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);
}
});