Created
April 23, 2018 12:23
-
-
Save bassaer/ec4f6035674b34e871f5cf9d6bf87c05 to your computer and use it in GitHub Desktop.
Androidでキーボードを閉じる方法メモ ref: https://qiita.com/bassaer/items/0e412d9f36b2113ee8d0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ContentFragment : Fragment() { | |
private fun hideKeyboard() { | |
val view = activity.currentFocus | |
if (view != null) { | |
val manager = activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | |
manager.hideSoftInputFromWindow(view.windowToken, 0) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment