本文整理了Java中android.widget.AutoCompleteTextView.setSelection()
方法的一些代码示例,展示了AutoCompleteTextView.setSelection()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AutoCompleteTextView.setSelection()
方法的具体详情如下:
包路径:android.widget.AutoCompleteTextView
类名称:AutoCompleteTextView
方法名:setSelection
暂无
代码示例来源:origin: andforce/iBeebo
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String searchFetchedWord = getItem(position).getNickname();
int searchFetchedWordLength = searchFetchedWord.length();
int calcResultSelectionPosition = atSignPosition + searchFetchedWordLength;
AutoCompleteAdapter.this.content.setSelection(calcResultSelectionPosition + 2);
}
});
代码示例来源:origin: linkasu/linkatype-android
public void pasteText(String s) {
int selectionStart = mAutoCompleteTextView.getSelectionStart();
mAutoCompleteTextView.setText(mAutoCompleteTextView.getText().insert(selectionStart, s).toString());
mAutoCompleteTextView.setSelection(selectionStart + s.length());
}
代码示例来源:origin: adolfAn/FBReader_AS
private void editTag(int position){
myEditPosition = position;
String s = (String)getListAdapter().getItem(position);
myInputField.setText(s);
myInputField.setSelection(myInputField.getText().length());
myInputField.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(myInputField, InputMethodManager.SHOW_IMPLICIT);
}
代码示例来源:origin: adolfAn/FBReader_AS
private void editAuthor(int position){
myEditPosition = position;
String s = (String)getListAdapter().getItem(position);
myInputField.setText(s);
myInputField.setSelection(myInputField.getText().length());
myInputField.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(myInputField, InputMethodManager.SHOW_IMPLICIT);
}
代码示例来源:origin: p-v/DateTimeSeer
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (awesomeAdapter != null) {
SuggestionRow suggestionRow = awesomeAdapter.getItem(position);
if (suggestionRow != null) {
String displayText;
if (suggestionRow.getValue() == SuggestionRow.PARTIAL_VALUE) {
displayText = suggestionRow.getDisplayValue() + " ";
// show dropdown for partial values
autoCompleteTextView.post(new Runnable() {
@Override
public void run() {
autoCompleteTextView.showDropDown();
}
});
} else {
displayText = suggestionRow.getDisplayValue();
long selectedTime = suggestionRow.getValue() * 1000L;
DateFormat df = new SimpleDateFormat("EEEE, d MMMM yyyy h:mma", Locale.ENGLISH);
String timeOnScreen = df.format(new Date(selectedTime));
Toast.makeText(MainActivity.this, String.format(getString(R.string.awesome_time),
timeOnScreen), Toast.LENGTH_SHORT).show();
}
autoCompleteTextView.setText(displayText);
autoCompleteTextView.setSelection(displayText.length());
}
}
}
});
内容来源于网络,如有侵权,请联系作者删除!