本文整理了Java中android.widget.AutoCompleteTextView.requestFocus()
方法的一些代码示例,展示了AutoCompleteTextView.requestFocus()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AutoCompleteTextView.requestFocus()
方法的具体详情如下:
包路径:android.widget.AutoCompleteTextView
类名称:AutoCompleteTextView
方法名:requestFocus
暂无
代码示例来源:origin: zulip/zulip-android
private void checkForChatBoxFocusRequest() {
if (TextUtils.isEmpty(streamActv.getText().toString()) && isCurrentModeStream()) {
streamActv.requestFocus();
} else if (TextUtils.isEmpty(topicActv.getText().toString())) {
topicActv.requestFocus();
} else {
messageEt.requestFocus();
}
}
代码示例来源:origin: posm/OpenMapKitAndroid
@Override
public void onClick(View view) {
if (editTextCheckBox.isChecked()) {
editText.setFocusableInTouchMode(true);
editText.requestFocus();
final InputMethodManager inputMethodManager = (InputMethodManager) activity
.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
}
}
});
代码示例来源:origin: posm/OpenMapKitAndroid
@Override
public void onClick(View view) {
if (customButton.isChecked()) {
customEditText.setFocusableInTouchMode(true);
customEditText.requestFocus();
final InputMethodManager inputMethodManager = (InputMethodManager) activity
.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(customEditText, InputMethodManager.SHOW_IMPLICIT);
}
}
});
代码示例来源:origin: CUTR-at-USF/OpenTripPlanner-for-Android
/**
* Sets text boxes to initial default locations.
* <p>
* MyLocation for start text box and empty for end text box.
* <p>
* Accordingly preference with key PREFERENCE_KEY_ORIGIN_IS_MY_LOCATION
* is set.
*/
private void restartTextBoxes() {
SharedPreferences.Editor prefsEditor = mPrefs.edit();
setTextBoxLocation(mApplicationContext.getResources().getString(R.string.text_box_my_location),
true);
prefsEditor.putBoolean(OTPApp.PREFERENCE_KEY_ORIGIN_IS_MY_LOCATION, true);
prefsEditor.commit();
mIsStartLocationGeocodingCompleted = true;
mIsEndLocationGeocodingCompleted = false;
mTbEndLocation.requestFocus();
setTextBoxLocation("", false);
}
代码示例来源:origin: TongmingWu/Manga
@Override
public boolean onTouch(View v, MotionEvent event) {
etSearch.setFocusable(true);
etSearch.setFocusableInTouchMode(true);
etSearch.requestFocus();
String word = etSearch.getText().toString().trim();
editHint(word);
return false;
}
});
代码示例来源:origin: szpnygo/NoWordsChat
public void setContentView(View contentView) {
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
contentView.setLayoutParams(layoutParams);
if (contentView instanceof ListView) {
setListViewHeightBasedOnChildren((ListView) contentView);
}
LinearLayout linearLayout = (LinearLayout) mAlertDialogWindow.findViewById(R.id.message_content_view);
if (linearLayout != null) {
linearLayout.removeAllViews();
linearLayout.addView(contentView);
}
for (int i = 0; i < linearLayout.getChildCount(); i++) {
if (linearLayout.getChildAt(i) instanceof AutoCompleteTextView) {
AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) linearLayout.getChildAt(i);
autoCompleteTextView.setFocusable(true);
autoCompleteTextView.requestFocus();
autoCompleteTextView.setFocusableInTouchMode(true);
}
}
}
代码示例来源:origin: q805699513/OptionFrame
public void setContentView(View contentView) {
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
contentView.setLayoutParams(layoutParams);
if (contentView instanceof ListView) {
setListViewHeightBasedOnChildren((ListView) contentView);
}
LinearLayout linearLayout = (LinearLayout) mAlertDialogWindow.findViewById(
R.id.message_content_view);
if (linearLayout != null) {
linearLayout.removeAllViews();
linearLayout.addView(contentView);
}
for (int i = 0; i < (linearLayout != null ? linearLayout.getChildCount() : 0); i++) {
if (linearLayout.getChildAt(i) instanceof AutoCompleteTextView) {
AutoCompleteTextView autoCompleteTextView
= (AutoCompleteTextView) linearLayout.getChildAt(i);
autoCompleteTextView.setFocusable(true);
autoCompleteTextView.requestFocus();
autoCompleteTextView.setFocusableInTouchMode(true);
}
}
}
代码示例来源:origin: phw/Android-PwdHash
@Override
public void onClick(View v) {
String realm = getDomain();
String password = mPassword.getText().toString();
if (realm.equals("")) {
mSiteAddress.requestFocus();
} else if (password.equals("")) {
mPassword.requestFocus();
} else {
String hashedPassword = updateHashedPassword(realm, password);
if (!hashedPassword.equals("")) {
new UpdateHistoryTask(mHistory).execute(realm);
copyToClipboard(hashedPassword);
CharSequence clipboardNotification = getString(R.string.copiedToClipboardNotification);
showNotification(clipboardNotification);
mSaveStateOnExit = false;
finish();
}
}
}
});
代码示例来源:origin: ecgreb/mvpc
@Override public void showEmailError(ErrorType errorType) {
switch (errorType) {
case EMPTY:
mEmailView.setError(getContext().getString(R.string.error_field_required));
break;
case INVALID:
mEmailView.setError(getContext().getString(R.string.error_invalid_email));
break;
}
mEmailView.requestFocus();
}
代码示例来源:origin: q805699513/OptionFrame
.getChildAt(i);
autoCompleteTextView.setFocusable(true);
autoCompleteTextView.requestFocus();
autoCompleteTextView.setFocusableInTouchMode(true);
代码示例来源:origin: zulip/zulip-android
/**
* Fills the chatBox with the stream name and the topic
*
* @param stream Stream name to be filled
* @param subject Subject to be filled
* @param openSoftKeyboard If true open's the softKeyboard else not
*/
public void onNarrowFillSendBoxStream(String stream, String subject, boolean openSoftKeyboard) {
displayChatBox(true);
displayFAB(false);
switchToStream();
streamActv.setText(stream);
topicActv.setText(subject);
if ("".equals(subject)) {
topicActv.requestFocus();
} else messageEt.requestFocus();
if (openSoftKeyboard) {
showSoftKeyboard();
}
}
代码示例来源: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: 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: Coinomi/coinomi-android
private void requestFocusFirst() {
if (!isOutputsValid()) {
sendToAddressView.requestFocus();
} else if (!isAmountValid()) {
amountCalculatorLink.requestFocus();
// FIXME causes problems in older Androids
// Keyboard.focusAndShowKeyboard(sendAmountView, getActivity());
} else if (isTxMessageAdded && !isTxMessageValid()) {
txMessageView.requestFocus();
} else if (everythingValid()) {
sendConfirmButton.requestFocus();
} else {
log.warn("unclear focus");
}
}
代码示例来源:origin: openwalletGH/openwallet-android
private void requestFocusFirst() {
if (!isOutputsValid()) {
sendToAddressView.requestFocus();
} else if (!isAmountValid()) {
amountCalculatorLink.requestFocus();
// FIXME causes problems in older Androids
// Keyboard.focusAndShowKeyboard(sendAmountView, getActivity());
} else if (isTxMessageAdded && !isTxMessageValid()) {
txMessageView.requestFocus();
} else if (everythingValid()) {
sendConfirmButton.requestFocus();
} else {
log.warn("unclear focus");
}
}
代码示例来源:origin: AmaldevTA/ChipLayout
private void onLayoutClick(){
int totalChips = this.getChildCount() - 1;
if(totalChips < 0){
createNewChipLayout(null);
}else{
AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) ((ViewGroup)this.getChildAt(totalChips)).getChildAt(labelPosition);
if(autoCompleteTextView.isFocusable()){
autoCompleteTextView.requestFocus();
InputMethodManager inputMethodManager=(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInputFromWindow(autoCompleteTextView.getApplicationWindowToken(), InputMethodManager.SHOW_FORCED, 0);
}else{
createNewChipLayout(null);
}
}
}
代码示例来源:origin: zulip/zulip-android
@Override
public void onNarrowFillSendBoxPrivate(Person peopleList[], boolean openSoftKeyboard) {
displayChatBox(true);
displayFAB(false);
switchToPrivate();
ArrayList<String> names = new ArrayList<String>();
if (peopleList.length == 1) {
names.add(peopleList[0].getEmail());
} else {
for (Person person : peopleList) {
if (person.getId() != app.getYou().getId()) {
names.add(person.getEmail());
}
}
}
topicActv.setText(TextUtils.join(", ", names));
messageEt.requestFocus();
if (openSoftKeyboard) {
showSoftKeyboard();
}
}
代码示例来源:origin: zulip/zulip-android
/**
* Fills the chatBox according to the {@link MessageType}
*
* @param openSoftKeyboard If true open's up the SoftKeyboard else not.
*/
@Override
public void onNarrowFillSendBox(Message message, boolean openSoftKeyboard) {
displayChatBox(true);
displayFAB(false);
if (message.getType() == MessageType.PRIVATE_MESSAGE) {
switchToPrivate();
topicActv.setText(message.getReplyTo(app));
messageEt.requestFocus();
} else {
switchToStream();
streamActv.setText(message.getStream().getName());
topicActv.setText(message.getSubject());
if ("".equals(message.getSubject())) {
topicActv.requestFocus();
} else messageEt.requestFocus();
}
if (openSoftKeyboard) {
showSoftKeyboard();
}
}
代码示例来源:origin: zaynr/Carpool-Android-Client
@Override
public void onClick(View view) {
if (TextUtils.isEmpty(destAuto.getText())) {
destAuto.setError("请输入终点");
destAuto.requestFocus();
return;
}
if(destLatlng==null){
Toast.makeText(getApplicationContext(), "未搜索到终点位置", Toast.LENGTH_SHORT).show();
return;
}
placeOrder.setClickable(true);
mBaiduMap.clear();
mSearchRoute.drivingSearch((new DrivingRoutePlanOption())
.from(PlanNode.withLocation(oriLatlng)).to(PlanNode.withLocation(destLatlng)));
}
});
代码示例来源:origin: stripe/stripe-android
@Test
public void countryAutoCompleteTextView_onInputFocus_displayDropDown() {
mAutoCompleteTextView.clearFocus();
assertFalse(mAutoCompleteTextView.isPopupShowing());
mAutoCompleteTextView.requestFocus();
assertTrue(mAutoCompleteTextView.isPopupShowing());
}
内容来源于网络,如有侵权,请联系作者删除!