Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用片段开发一个 android 应用程序。我有一个片段,其中包含一个包含一些值的列表。当我单击列表视图中的一个项目时,它会被重定向到另一个片段。我在那个片段中有一个编辑文本。当我按下那个编辑文本键盘弹出。
现在我的问题是,当我回到前一个片段而不最小化键盘时,前一个片段中的键盘统计信息也是如此。
当我回到第一个屏幕时如何移除键盘?
Fragment您强制完全隐藏键盘
Fragment
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getView().getWindowToken(), 0);