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

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

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

AutoCompleteTextView.setOnFocusChangeListener介绍

暂无

代码示例

代码示例来源:origin: openwalletGH/openwallet-android

private void setSendToAddressText(String addressStr) {
  // Remove listener before changing input, to avoid infinite recursion
  sendToAddressView.removeTextChangedListener(receivingAddressListener);
  sendToAddressView.setOnFocusChangeListener(null);
  sendToAddressView.setText(addressStr);
  sendToAddressView.addTextChangedListener(receivingAddressListener);
  sendToAddressView.setOnFocusChangeListener(receivingAddressListener);
}

代码示例来源:origin: Coinomi/coinomi-android

private void setSendToAddressText(String addressStr) {
  // Remove listener before changing input, to avoid infinite recursion
  sendToAddressView.removeTextChangedListener(receivingAddressListener);
  sendToAddressView.setOnFocusChangeListener(null);
  sendToAddressView.setText(addressStr);
  sendToAddressView.addTextChangedListener(receivingAddressListener);
  sendToAddressView.setOnFocusChangeListener(receivingAddressListener);
}

代码示例来源:origin: AmaldevTA/ChipLayout

@Override
public void setOnFocusChangeListener(OnFocusChangeListener f) {
  onFocusChangeListener = f;
  if (this.getChildCount() > 0){
    AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) ((ViewGroup)this.getChildAt(this.getChildCount()-1)).getChildAt(labelPosition);
    OnFocusChangeListener focusChangeListener = new ChipOnFocusChangeListener(this, autoCompleteTextView,
        chipDrawable, chipLayoutDrawable, onFocusChangeListener);
    autoCompleteTextView.setOnFocusChangeListener(focusChangeListener);
  }
}

代码示例来源:origin: openmrs/openmrs-contrib-android-client

edcountry.setOnFocusChangeListener(new View.OnFocusChangeListener() {
  @Override
  public void onFocusChange(View v, boolean hasFocus) {
edstate.setOnFocusChangeListener(new View.OnFocusChangeListener() {
  @Override
  public void onFocusChange(View v, boolean hasFocus) {

代码示例来源:origin: kaytat/SimpleProtocolPlayer

mIPAddrText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
  @Override
  public void onFocusChange(View v, boolean hasFocus) {
mAudioPortText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
  @Override
  public void onFocusChange(View v, boolean hasFocus) {

代码示例来源:origin: openwalletGH/openwallet-android

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
             Bundle savedInstanceState) {
  // Inflate the layout for this fragment
  View view = inflater.inflate(R.layout.fragment_send, container, false);
  ButterKnife.bind(this, view);
  sendToAdapter = new ReceivingAddressViewAdapter(inflater.getContext());
  sendToAddressView.setAdapter(sendToAdapter);
  sendToAddressView.setOnFocusChangeListener(receivingAddressListener);
  sendToAddressView.addTextChangedListener(receivingAddressListener);
  sendCoinAmountView.resetType(sendAmountType, true);
  if (sendAmount != null) sendCoinAmountView.setAmount(sendAmount, false);
  sendLocalAmountView.setFormat(FiatType.FRIENDLY_FORMAT);
  amountCalculatorLink = new CurrencyCalculatorLink(sendCoinAmountView, sendLocalAmountView);
  amountCalculatorLink.setExchangeDirection(config.getLastExchangeDirection());
  amountCalculatorLink.setExchangeRate(getCurrentRate());
  addressError.setVisibility(View.GONE);
  amountError.setVisibility(View.GONE);
  amountWarning.setVisibility(View.GONE);
  setupTxMessage();
  return view;
}

代码示例来源:origin: Coinomi/coinomi-android

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
             Bundle savedInstanceState) {
  // Inflate the layout for this fragment
  View view = inflater.inflate(R.layout.fragment_send, container, false);
  ButterKnife.bind(this, view);
  sendToAdapter = new ReceivingAddressViewAdapter(inflater.getContext());
  sendToAddressView.setAdapter(sendToAdapter);
  sendToAddressView.setOnFocusChangeListener(receivingAddressListener);
  sendToAddressView.addTextChangedListener(receivingAddressListener);
  sendCoinAmountView.resetType(sendAmountType, true);
  if (sendAmount != null) sendCoinAmountView.setAmount(sendAmount, false);
  sendLocalAmountView.setFormat(FiatType.FRIENDLY_FORMAT);
  amountCalculatorLink = new CurrencyCalculatorLink(sendCoinAmountView, sendLocalAmountView);
  amountCalculatorLink.setExchangeDirection(config.getLastExchangeDirection());
  amountCalculatorLink.setExchangeRate(getCurrentRate());
  addressError.setVisibility(View.GONE);
  amountError.setVisibility(View.GONE);
  amountWarning.setVisibility(View.GONE);
  setupTxMessage();
  return view;
}

代码示例来源:origin: stripe/stripe-android

private void initView() {
  inflate(getContext(), R.layout.country_autocomplete_textview, this);
  mCountryAutocomplete = findViewById(R.id.autocomplete_country_cat);
  mCountryNameToCode = CountryUtils.getCountryNameToCodeMap();
  final ArrayAdapter countryAdapter = new CountryAdapter(getContext(),
      new ArrayList<>(mCountryNameToCode.keySet()));
  mCountryAutocomplete.setThreshold(0);
  mCountryAutocomplete.setAdapter(countryAdapter);
  mCountryAutocomplete.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
      String countryEntered = mCountryAutocomplete.getText().toString();
      updateUIForCountryEntered(countryEntered);
    }
  });
  String defaultCountryEntered = (String) countryAdapter.getItem(0);
  updateUIForCountryEntered(defaultCountryEntered);
  mCountryAutocomplete.setText(defaultCountryEntered);
  mCountryAutocomplete.setOnFocusChangeListener(new OnFocusChangeListener() {
    @Override
    public void onFocusChange(View view, boolean focused) {
      String countryEntered = mCountryAutocomplete.getText().toString();
      if (focused) {
        mCountryAutocomplete.showDropDown();
      } else {
        updateUIForCountryEntered(countryEntered);
      }
    }
  });
}

代码示例来源:origin: dsolonenko/financisto

private void initAutoCompleteFilter(final AutoCompleteTextView filterTxt) { // init only after it's toggled
  autoCompleteAdapter = TransactionUtils.createCategoryFilterAdapter(activity, db);
  filterTxt.setInputType(InputType.TYPE_CLASS_TEXT 
          | InputType.TYPE_TEXT_FLAG_CAP_WORDS 
          | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
          | InputType.TYPE_TEXT_VARIATION_FILTER);
  filterTxt.setThreshold(1);
  filterTxt.setOnFocusChangeListener((view, hasFocus) -> {
    if (hasFocus) {
      filterTxt.setAdapter(requireNonNull(autoCompleteAdapter));
      filterTxt.selectAll();
    }
  });
  filterTxt.setOnItemClickListener((parent, view, position, id) -> {
    activity.onSelectedId(R.id.category, id);
    ToggleButton toggleBtn = (ToggleButton) filterTxt.getTag();
    toggleBtn.performClick();
  });
}

代码示例来源:origin: googlesamples/android-AutofillFramework

mUsernameAutoCompleteField.setOnFocusChangeListener((v, hasFocus) -> {
  if (hasFocus) {
    mUsernameAutoCompleteField.showDropDown();

代码示例来源:origin: dsolonenko/financisto

private void initAutoCompleteFilter(final AutoCompleteTextView filterTxt) {
  filterAdapter = createFilterAdapter();
  filterTxt.setInputType(InputType.TYPE_CLASS_TEXT
      | InputType.TYPE_TEXT_FLAG_CAP_WORDS
      | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
      | InputType.TYPE_TEXT_VARIATION_FILTER);
  filterTxt.setThreshold(1);
  filterTxt.setOnFocusChangeListener((view, hasFocus) -> {
    if (hasFocus) {
      filterTxt.setAdapter(filterAdapter);
      filterTxt.selectAll();
    }
  });
  filterTxt.setOnItemClickListener((parent, view, position, id) -> {
    activity.onSelectedId(layoutId, id);
    ToggleButton toggleBtn = (ToggleButton) filterTxt.getTag();
    toggleBtn.performClick();
  });
}

代码示例来源:origin: WowzaMediaSystems/gocoder-sdk-samples-android

mAutoCompleteEditText.setAdapter(adapter);
mAutoCompleteEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
  @Override
  public void onFocusChange(View view, boolean focused) {

代码示例来源:origin: zulip/zulip-android

messageEt.setOnFocusChangeListener(focusChangeListener);
topicActv.setOnFocusChangeListener(focusChangeListener);
streamActv.setOnFocusChangeListener(focusChangeListener);

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

mTbStartLocation.setOnFocusChangeListener(tbLocationOnFocusChangeListener);
mTbEndLocation.setOnFocusChangeListener(tbLocationOnFocusChangeListener);

代码示例来源:origin: AmaldevTA/ChipLayout

autoCompleteTextView.setOnFocusChangeListener(focusChangeListener);

代码示例来源:origin: derry/delion

mInput.setOnFocusChangeListener(new OnFocusChangeListener() {
  @Override
  public void onFocusChange(View v, boolean hasFocus) {

相关文章

AutoCompleteTextView类方法