本文整理了Java中android.support.v4.app.FragmentActivity.getCurrentFocus()
方法的一些代码示例,展示了FragmentActivity.getCurrentFocus()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FragmentActivity.getCurrentFocus()
方法的具体详情如下:
包路径:android.support.v4.app.FragmentActivity
类名称:FragmentActivity
方法名:getCurrentFocus
暂无
代码示例来源:origin: DaxiaK/MyDiary
private DiaryTextTag checkoutOldDiaryContent() {
View focusView = getActivity().getCurrentFocus();
DiaryTextTag tag = null;
if (focusView instanceof EditText && focusView.getTag() != null &&
focusView.getTag() instanceof DiaryTextTag) {
EditText currentEditText = (EditText) focusView;
tag = (DiaryTextTag) focusView.getTag();
if (currentEditText.getText().toString().length() > 0) {
int index = currentEditText.getSelectionStart();
String nextEditTextStr = currentEditText.getText().toString()
.substring(index, currentEditText.getText().toString().length());
currentEditText.getText().delete(index, currentEditText.getText().toString().length());
tag.setNextEditTextStr(nextEditTextStr);
}
}
return tag;
}
代码示例来源:origin: huangfangyi/FanXin
protected void hideSoftKeyboard() {
if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getActivity().getCurrentFocus() != null)
inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
代码示例来源:origin: huangfangyi/FanXin
protected void hideSoftKeyboard() {
if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getActivity().getCurrentFocus() != null)
inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
代码示例来源:origin: WuXiaolong/WoChat
/**
* 隐藏软键盘
*/
protected void hideKeyboard() {
if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getActivity().getCurrentFocus() != null)
inputManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
代码示例来源:origin: easemob/livestream_demo_android
protected void hideSoftKeyboard() {
if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getActivity().getCurrentFocus() != null)
inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
代码示例来源:origin: zhangchunbin/HuanXinDemo
/**
* hide
*/
protected void hideKeyboard() {
if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getActivity().getCurrentFocus() != null)
inputManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
代码示例来源:origin: stevenwsg/XSY-University-trade
protected void hideSoftKeyboard() {
if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getActivity().getCurrentFocus() != null)
inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
代码示例来源:origin: WuXiaolong/WoChat
protected void hideSoftKeyboard() {
if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getActivity().getCurrentFocus() != null)
inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
代码示例来源:origin: zhangchunbin/HuanXinDemo
protected void hideSoftKeyboard() {
if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getActivity().getCurrentFocus() != null)
inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
代码示例来源:origin: stevenwsg/XSY-University-trade
/**
* hide
*/
protected void hideKeyboard() {
if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getActivity().getCurrentFocus() != null)
inputManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
代码示例来源:origin: lzan13/EaseUICustomer
/**
* 隐藏软键盘
*/
protected void hideKeyboard() {
if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getActivity().getCurrentFocus() != null)
inputManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
代码示例来源:origin: lzan13/EaseUICustomer
protected void hideSoftKeyboard() {
if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getActivity().getCurrentFocus() != null)
inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
代码示例来源:origin: lzan13/EaseUICustomer
protected void hideSoftKeyboard() {
if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getActivity().getCurrentFocus() != null)
inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
代码示例来源:origin: zhangchunbin/HuanXinDemo
protected void hideSoftKeyboard() {
if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getActivity().getCurrentFocus() != null)
inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
代码示例来源:origin: stevenwsg/XSY-University-trade
protected void hideSoftKeyboard() {
if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getActivity().getCurrentFocus() != null)
inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
代码示例来源:origin: huangfangyi/FanXin
/**
* hide
*/
protected void hideKeyboard() {
if (getActivity().getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
if (getActivity().getCurrentFocus() != null)
inputManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
代码示例来源:origin: grzegorznittner/chanu
private void closeKeyboard() {
IBinder windowToken = getActivity().getCurrentFocus() != null ?
getActivity().getCurrentFocus().getWindowToken()
: null;
if (windowToken != null) { // close the keyboard
InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(windowToken, 0);
}
}
代码示例来源:origin: grzegorznittner/chanu
private void closeKeyboard() {
IBinder windowToken = getActivity().getCurrentFocus() != null ?
getActivity().getCurrentFocus().getWindowToken()
: null;
if (windowToken != null) { // close the keyboard
InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(windowToken, 0);
}
}
}
代码示例来源:origin: yaozs/YzsBaseActivity
/**
* 关闭软键盘
*/
public void hideInput() {
if (getActivity().getCurrentFocus() == null) return;
((InputMethodManager) getActivity().getSystemService(INPUT_METHOD_SERVICE))
.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
代码示例来源:origin: openmrs/openmrs-contrib-android-client
@Override
public void hideSoftKeys() {
View view = this.getActivity().getCurrentFocus();
if (view == null) {
view = new View(this.getActivity());
}
InputMethodManager inputMethodManager = (InputMethodManager)this.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
内容来源于网络,如有侵权,请联系作者删除!