android.widget.TextView.clearFocus()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(165)

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

TextView.clearFocus介绍

暂无

代码示例

代码示例来源:origin: MuShare/Httper-Android

@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
  if (newState == BottomSheetBehavior.STATE_COLLAPSED) {
    dimBackground.setVisibility(View.GONE);
    textViewHeader.clearFocus();
    textViewURL.clearFocus();
  }
}

代码示例来源:origin: ywwynm/EverythingDone

@Override
  public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_DONE) {
      KeyboardUtil.hideKeyboard(v);
      v.clearFocus();
      return true;
    }
    return false;
  }
});

代码示例来源:origin: stackoverflow.com

private TextView.OnEditorActionListener numberEnterListener = new TextView.OnEditorActionListener(){
   public boolean onEditorAction(TextView tv, int actionId, KeyEvent event){
     if(actionId == EditorInfo.IME_ACTION_DONE 
       || actionId == EditorInfo.IME_NULL
       || event.getKeyCode() == KeyEvent.KEYCODE_ENTER){
       tv.clearFocus();
       //Stupid keyboard needs to be closed as well
       InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
       imm.hideSoftInputFromWindow(tv.getWindowToken(), 0);
       return true;
     } else {
       return false;
     }
   }
 };

代码示例来源:origin: smarek/android-unbound-dns

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  View mView = inflater.inflate(R.layout.textarea, container, false);
  mTextArea = (TextView) mView.findViewById(R.id.textarea);
  mTextArea.clearFocus();
  try {
    BufferedReader br = new BufferedReader(new FileReader(new File(getActivity().getFilesDir(), "package/bin/unbound.conf")));
    String line;
    while ((line = br.readLine()) != null) {
      mTextArea.append(line);
      mTextArea.append("\n");
    }
  } catch (Throwable e) {
    e.printStackTrace();
  }
  return mView;
}

相关文章

TextView类方法