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

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

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

AutoCompleteTextView.addTextChangedListener介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public void onCreate(Bundle state) {
 super.onCreate(state);
 setContentView(R.layout.main);
 selection=(TextView)findViewById(R.id.selection);
 edit=(AutoCompleteTextView)findViewById(R.id.edit);
 edit.addTextChangedListener(this);
 
 edit.setAdapter(new ArrayAdapter<String>(this,
            android.R.layout.simple_dropdown_item_1line,
            items));
}

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

String my_var; //keep track!
AutoCompleteTextView tv = (AutoCompleteTextView) layout.findViewById(R.id.tv);
tv.setAdapter(my_adapter);  
tv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    my_var = my_adapter.getItem(position).toString();
  }
});
/**
 * Unset the var whenever the user types. Validation will
 * then fail. This is how we enforce selecting from the list.
 */
tv.addTextChangedListener(new TextWatcher() {
  @Override
  public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
  @Override
  public void onTextChanged(CharSequence s, int start, int before, int count) {
    my_var = null;
  }
  @Override
  public void afterTextChanged(Editable s) {}
});

代码示例来源:origin: vir56k/demo

public void onStart() {
  autotext.addTextChangedListener(mTextWatcher);
  super.onStart();
}

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

mAutoCompleteTextView.addTextChangedListener(new TextWatcher() {

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

mAutoCompleteTextView.addTextChangedListener(new TextWatcher() {

代码示例来源:origin: linkasu/linkatype-android

public SayButtonController(AutoCompleteTextView speechInput, CategoryController categoryController, WordsController wordsController) {
  this.mAutoCompleteTextView = speechInput;
  this.mDatabaseManager = DatabaseManager.getInstance();
  this.mCategoryController = categoryController;
  this.mWordsController = wordsController;
  speechInput.addTextChangedListener(new TextWatcher() {
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    }
    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
      if (!TTS.getInstance().isSayAfterWordInput || before > count) return;
      if (s.charAt(s.length() - 1) == ' ') {
        String text = mAutoCompleteTextView.getText().toString();
        String[] b = text.split("\\s+");
        String word = b[b.length - 1];
        TTS.getInstance().speak(word, true);
      }
    }
    @Override
    public void afterTextChanged(Editable s) {
    }
  });
}

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

myAutoComplete.addTextChangedListener(this);
myAutoComplete.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, item));

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

public class MainActivity extends Activity {

AutoCompleteTextView autoCompleteTextView;

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  autoCompleteTextView = (AutoCompleteTextView) findViewById(R.id.AndroidBooks);

  StreetArrayAdapter adapter = new StreetArrayAdapter(MainActivity.this,
      android.R.layout.simple_gallery_item);
  autoCompleteTextView.setThreshold(1);
  autoCompleteTextView.setAdapter(adapter);
  autoCompleteTextView.addTextChangedListener(new StreetTextWatcher(
      autoCompleteTextView, adapter));

}
}

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

public void addLayoutTextChangedListener(TextWatcher textWatcher){
  listTextWatcher.add(textWatcher);
  if (this.getChildCount() > 0){
    AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) ((ViewGroup)this.getChildAt(this.getChildCount()-1)).getChildAt(labelPosition);
    autoCompleteTextView.addTextChangedListener(textWatcher);
  }
}

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

final AutoCompleteTextView textView = (AutoCompleteTextView)
    findViewById(R.id.auto);
textView.addTextChangedListener(new TextWatcher() {

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

autoCompleteTextView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list));
autoCompleteTextView.addTextChangedListener(new TextWatcher() {
  @Override
  public void beforeTextChanged(CharSequence s, int start, int count, int after) {

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

myAutoComplete.addTextChangedListener(this);
myAutoComplete.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line, presidents));

代码示例来源:origin: AEFeinstein/mtg-familiar

mFragment = context;
mFragment.getLoaderManager().initLoader(0, null, this);
textView.addTextChangedListener(new TextWatcher() {
  @Override
  public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {

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

autoCompleteTextView.setAdapter(adapter);
autoCompleteTextView.addTextChangedListener(new TextWatcher() {
  @Override
  public void beforeTextChanged(CharSequence s, int start, int count, int after) {

代码示例来源: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: 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: tananaev/rootless-logcat

autoCompleteTextView.addTextChangedListener(new TextWatcher() {
  boolean skipFirst = true;

代码示例来源:origin: henrichg/PhoneProfilesPlus

mAutoCompleteTextView.addTextChangedListener(this);
mAutoCompleteTextView.setOnItemClickListener(this);
mAutoCompleteTextView.setOnClickListener(this);

代码示例来源: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: 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;
}

相关文章

AutoCompleteTextView类方法