android.widget.AutoCompleteTextView.hasFocus()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(116)

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

AutoCompleteTextView.hasFocus介绍

暂无

代码示例

代码示例来源:origin: CUTR-at-USF/OpenTripPlanner-for-Android

@Override
  public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
    changingTextBoxWithAutocomplete = true;
    boolean isStartBox = mTbStartLocation.hasFocus();
    CustomAddress selectedAddress = (CustomAddress) adapterView.getItemAtPosition(position);
    useNewAddress(isStartBox, selectedAddress, false);
  }
};

代码示例来源:origin: CUTR-at-USF/OpenTripPlanner-for-Android

/**
 * Removes focus from the text box chosen by the parameter and deletes map click listener if
 * none of the text boxes remain focused.
 *
 * @param isStartTextbox to select text box to removes focus from
 */
private void removeFocus(boolean isStartTextbox) {
  if (!mMapFailed){
    if (isStartTextbox) {
      mTbStartLocation.clearFocus();
      if (!mTbEndLocation.hasFocus()){
        mMap.setOnMapClickListener(null);
      }
    } else {
      mTbEndLocation.clearFocus();
      if (!mTbStartLocation.hasFocus()){
        mMap.setOnMapClickListener(null);
      }
    }
  }
}

代码示例来源:origin: CUTR-at-USF/OpenTripPlanner-for-Android

@Override
  public void onMapClick(LatLng latlng) {
    InputMethodManager imm = (InputMethodManager) MainFragment.this.getActivity()
        .getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(mTbEndLocation.getWindowToken(), 0);
    imm.hideSoftInputFromWindow(mTbStartLocation.getWindowToken(), 0);
    if (mTbStartLocation.hasFocus()) {
      setMarker(true, latlng, true, true);
    } else {
      setMarker(false, latlng, true, true);
    }
    processRequestTrip();
  }
};

代码示例来源:origin: zadr50/Gojek

@Override
  public void onResult(PlaceBuffer places) {
    if( places.getStatus().isSuccess() ) {
      Place place = places.get( 0 );
      mPlaceTujuan=place;
      displayPlace( place );
      mPredictTextView.setText( "" );
      mPredictTextView.clearFocus();
      mAdapter.clear();
      // Check if no view has focus:
      if (mPredictTextView.hasFocus()) {
        InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(mPredictTextView.getWindowToken(), 0);
      }
    }
    //Release the PlaceBuffer to prevent a memory leak
    places.release();
  }
} );

相关文章

AutoCompleteTextView类方法