1
我面临和我的一个有点复杂片段布局XML的情况下,背景干扰
所以层次如下为:
RelativeLayout的(无背景)
--ScrollView(fillViewPort =真,滚动条=无)
----的FrameLayout(无背景)
------的LinearLayout(无背景)
-------- RelativeLayout的(灰色背景颜色)
---------- EditText
...
所以,当点击的EditText它打开软键盘(如预期),而当背压或隐藏键盘下面的方法一定点击块:
try {
InputMethodManager inputMethodManager = (InputMethodManager) GlobalApplication.getInstance().getCurrentActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(GlobalApplication.getInstance().getCurrentActivity().getCurrentFocus().getWindowToken(), 0);
} catch (Exception e) {
if (e.getMessage() != null)
Log.d("KeyboardError", e.getMessage());
}
的问题是我”对于活动有红色背景,当隐藏键盘动作发生时,我看到活动的背景,而不是RelativeLayout的灰色背景,并且发生像是毛刺或卡住。一段时间后,它恢复正常,并显示适当的背景。
感谢您的帮助,欢呼声。
指定要使用的Android版本。这将有助于找到答案 – The4thIceman
它发生在几个版本的Android 4.4.2 5.1 6.0 7.0 –