键盘出现时如何隐藏ImageView
(按下某些键后EditText
)。ImageView
然后在关闭键盘时显示这个?
问问题
3570 次
2 回答
3
我认为OnFocusChangeListener
这对你来说可能是正确的。
editText.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
// view/hide ImageView
}
});
于 2013-03-18T15:37:05.550 回答
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);
}
});
于 2013-03-18T21:03:41.810 回答