本文整理了Java中android.widget.AutoCompleteTextView.setThreshold()
方法的一些代码示例,展示了AutoCompleteTextView.setThreshold()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AutoCompleteTextView.setThreshold()
方法的具体详情如下:
包路径:android.widget.AutoCompleteTextView
类名称:AutoCompleteTextView
方法名:setThreshold
暂无
代码示例来源:origin: rey5137/material
/**
* <p>Specifies the minimum number of characters the user has to type in the
* edit box before the drop down list is shown.</p>
*
* <p>When <code>threshold</code> is less than or equals 0, a threshold of
* 1 is applied.</p>
*
* <p>Only work when autoComplete mode is {@link #AUTOCOMPLETE_MODE_SINGLE} or {@link #AUTOCOMPLETE_MODE_MULTI}</p>
*
* @param threshold the number of characters to type before the drop down
* is shown
*
* @see #getThreshold()
*
* @attr ref android.R.styleable#AutoCompleteTextView_completionThreshold
*/
public void setThreshold(int threshold) {
if(mAutoCompleteMode == AUTOCOMPLETE_MODE_NONE)
return;
((AutoCompleteTextView)mInputView).setThreshold(threshold);
}
代码示例来源:origin: rey5137/material
v.setCompletionHint(a.getString(attr));
else if(attr == R.styleable.AutoCompleteTextView_android_completionThreshold)
v.setThreshold(a.getInteger(attr, 0));
else if(attr == R.styleable.AutoCompleteTextView_android_dropDownAnchor)
v.setDropDownAnchor(a.getResourceId(attr, 0));
代码示例来源:origin: com.actionbarsherlock/actionbarsherlock
@Override
public void setThreshold(int threshold) {
super.setThreshold(threshold);
mThreshold = threshold;
}
代码示例来源:origin: posm/OpenMapKitAndroid
private void setupAutoComplete() {
Set<String> tagValues = OSMDataSet.tagValues();
String[] tagValuesArr = tagValues.toArray(new String[tagValues.size()]);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this.getActivity(),
android.R.layout.simple_dropdown_item_1line, tagValuesArr);
tagValueEditText.setAdapter(adapter);
tagValueEditText.setThreshold(1);
}
代码示例来源:origin: posm/OpenMapKitAndroid
private void setupAutoComplete(AutoCompleteTextView autoCompleteTextView) {
Set<String> tagValues = OSMDataSet.tagValues();
String[] tagValuesArr = tagValues.toArray(new String[tagValues.size()]);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this.getActivity(),
android.R.layout.simple_dropdown_item_1line, tagValuesArr);
autoCompleteTextView.setAdapter(adapter);
autoCompleteTextView.setThreshold(1);
}
代码示例来源:origin: posm/OpenMapKitAndroid
private void setupAutoComplete(AutoCompleteTextView autoCompleteTextView) {
Set<String> tagValues = OSMDataSet.tagValues();
String[] tagValuesArr = tagValues.toArray(new String[tagValues.size()]);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this.getActivity(),
android.R.layout.simple_dropdown_item_1line, tagValuesArr);
autoCompleteTextView.setAdapter(adapter);
autoCompleteTextView.setThreshold(1);
}
代码示例来源: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: vogellacompany/codeexamples-android
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AutoCompleteTextView view = (AutoCompleteTextView) findViewById(R.id.autoComplete);
String[] androidversion = getResources().
getStringArray(R.array.android_versoins);
ArrayAdapter<String> adapter =
new ArrayAdapter<String>
(this,R.layout.row_layout,
R.id.textView,
androidversion);
view.setThreshold(1);
view.setAdapter(adapter);
}
}
代码示例来源:origin: stackoverflow.com
String[] values = {
"abc_0", "def_0", "ghi_0",
"abc_1", "def_1", "ghi_1",
"abc_2", "def_2", "ghi_2",
"abc_3", "def_3", "ghi_3",
};
final AutoCompleteTextView actv = (AutoCompleteTextView) findViewById(R.id.actv);
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, values);
actv.setAdapter(adapter);
actv.setThreshold(256); // if not enough set Integer.MAX_VALUE
findViewById(R.id.button).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
CharSequence constraint = actv.getText();
adapter.getFilter().filter(constraint);
actv.showDropDown();
}
});
代码示例来源:origin: stackoverflow.com
String[] values = {
"abc_0", "def_0", "ghi_0",
"abc_1", "def_1", "ghi_1",
"abc_2", "def_2", "ghi_2",
"abc_3", "def_3", "ghi_3",
};
final AutoCompleteTextView actv = (AutoCompleteTextView) findViewById(R.id.actv);
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, values);
actv.setAdapter(adapter);
actv.setThreshold(256); // if not enough set Integer.MAX_VALUE
findViewById(R.id.button).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
CharSequence constraint = actv.getText();
adapter.getFilter().filter(constraint);
actv.showDropDown();
}
});
代码示例来源:origin: stackoverflow.com
autoCompleteTextView.setThreshold(1);
autoCompleteTextView.setAdapter(adapter);
代码示例来源:origin: stackoverflow.com
autocomplete_searchField.setAdapter(adapter);
autocomplete_searchField.setThreshold(1);
代码示例来源:origin: stackoverflow.com
super(context, attrs);
mEditText = new AutoCompleteTextView(context, attrs);
mEditText.setThreshold(0);
代码示例来源:origin: tananaev/rootless-logcat
public static void setAutoCompleteTextViewAdapter(Context context, final AutoCompleteTextView autoCompleteTextView, String[] history) {
autoCompleteTextView.setThreshold(1);
autoCompleteTextView.setAdapter(tagAdapter);
代码示例来源:origin: playerone-id/EosCommander
public static void setupAccountHistory( AutoCompleteTextView... autoTextViewArray ) {
for ( AutoCompleteTextView actv : autoTextViewArray ) {
AccountAdapter adapter = new AccountAdapter(actv.getContext(), R.layout.account_suggestion, R.id.eos_account);
if (actv instanceof MultiAutoCompleteTextView) {
((MultiAutoCompleteTextView) actv).setTokenizer(new WhitSpaceTokenizer());
}
actv.setThreshold(1);
actv.setAdapter(adapter);
}
}
代码示例来源:origin: pchauhan/AutoCompleteEditTextWithContact
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mEdtPhoneNumber = (EditText)findViewById(R.id.edtPhoneNumber);
mAutoCompleteTextView = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView);
mContactAdapter = new ContactAdapter(this ,R.layout.contact_list_item,arrContact);
mAutoCompleteTextView.setThreshold(1);
mAutoCompleteTextView.setAdapter(mContactAdapter);
}
public ArrayList<Contact_Object> getPhoneNumber(String name, Context context) {
代码示例来源: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: 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: googlesamples/android-AutofillFramework
android.R.layout.simple_dropdown_item_1line);
mUsernameAutoCompleteField.setAdapter(mockAutocompleteAdapter);
mUsernameAutoCompleteField.setThreshold(1);
代码示例来源: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();
});
}
内容来源于网络,如有侵权,请联系作者删除!