android.widget.EditText.onFocusChanged()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(235)

本文整理了Java中android.widget.EditText.onFocusChanged()方法的一些代码示例,展示了EditText.onFocusChanged()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EditText.onFocusChanged()方法的具体详情如下:
包路径:android.widget.EditText
类名称:EditText
方法名:onFocusChanged

EditText.onFocusChanged介绍

暂无

代码示例

代码示例来源:origin: ZieIony/Carbon

@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
  super.onFocusChanged(focused, direction, previouslyFocusedRect);
  if (focused) {
    if (clearFocusOnTouchOutside) {

代码示例来源:origin: vekexasia/android-edittext-validator

/**
 * In onFocusChanged() we also have to reshow the error icon as the Editor
 * hides it. Because Editor is a hidden class we need to cache the last used
 * icon and use that
 */
@Override
protected void onFocusChanged(boolean focused, int direction,
               Rect previouslyFocusedRect) {
  super.onFocusChanged(focused, direction, previouslyFocusedRect);
  showErrorIconHax(lastErrorIcon);
}

代码示例来源:origin: zhuanghongji/custom-android-keyboard

@Override
protected void onFocusChanged(boolean focused, int direction,
               Rect previouslyFocusedRect) {
  //		if(this.isFocused() && isPassword){
  //			if(null != password_ && password_.equalsIgnoreCase("password")){
  //				bv_.inputManager_.hideSoftInputFromWindow(this.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
  //				if(bv_.dlg == null || !bv_.dlg.isShowing()){
  //	        		if(this.isEnabled()){
  //	        			bv_.OnCreateInputWindow(this);
  //	        		}
  //	        	}
  //			}
  //		}else{
  //
  //		}
  super.onFocusChanged(focused, direction, previouslyFocusedRect);
}

代码示例来源:origin: wasdennnoch/AndroidN-ify

@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
  super.onFocusChanged(focused, direction, previouslyFocusedRect);
  if (!focused) {
    defocusIfNeeded();
  }
}

代码示例来源:origin: xyxyLiu/Edit-Spinner

@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
  super.onFocusChanged(focused, direction, previouslyFocusedRect);
  if (!focused) {
    dismissDropDown();
  }
}

代码示例来源:origin: Ronak-LM/memoir

@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
  super.onFocusChanged(focused, direction, previouslyFocusedRect);
  if (mUseRTFormatting && mListener != null) {
    mListener.onFocusChanged(this, focused);
  }
}

代码示例来源:origin: fanatic-mobile-developer-for-android/A-week-to-develop-android-app-plan

@Override
protected void onFocusChanged(boolean focused, int direction,
    Rect previouslyFocusedRect) {
  if (focused) {
    CleanEditText.this.setEditTextDrawable();
  } else {
    setCompoundDrawables(null, null, null, null);
  }
  
  super.onFocusChanged(focused, direction, previouslyFocusedRect);
}

代码示例来源:origin: fanatic-mobile-developer-for-android/A-week-to-develop-android-app-plan

@Override
protected void onFocusChanged(boolean focused, int direction,
    Rect previouslyFocusedRect) {
  if (focused) {
    CleanEditText.this.setEditTextDrawable();
  } else {
    setCompoundDrawables(null, null, null, null);
  }
  
  super.onFocusChanged(focused, direction, previouslyFocusedRect);
}

代码示例来源:origin: zyl409214686/CustomKeyboardView

@SuppressLint("MissingSuperCall")
@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
  if (!focused) {
    hideKeyboard();
  } else {
    hideSysInput();
    showKeyboard();
  }
  super.onFocusChanged(focused, direction, previouslyFocusedRect);
}

代码示例来源:origin: geniusgithub/AndroidDialer

@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
  super.onFocusChanged(focused, direction, previouslyFocusedRect);
  if (focused) {
    onStartEdit();
  } else if (!isButtonsFocused()) {
    onEndEdit();
  }
}

代码示例来源:origin: wythe0102/Mall

@Override
protected void onFocusChanged(boolean focused, int direction,
        Rect previouslyFocusedRect) {
    //获得焦点,判断是否有内容
    if (this.hasFocus() == true) {
        //如果没有内容,则保护显示清空按钮,否则就显示
        if (getText().toString().length() == 0){
      setCompoundDrawables(null, null, null, null);
        } else {
      setCompoundDrawables(null, null, this.dRight, null);
        }
    }else{
        //失去焦点,隐藏按钮
        setCompoundDrawables(null, null, null, null);
    }
    super.onFocusChanged(focused, direction, previouslyFocusedRect);
}

相关文章

微信公众号

最新文章

更多

EditText类方法