android.widget.Button.requestFocus()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(222)

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

Button.requestFocus介绍

暂无

代码示例

代码示例来源:origin: GeoODK/collect

@Override
public void setFocus(Context context) {
  // focus on launch button
  mLaunchIntentButton.requestFocus();
}

代码示例来源:origin: THEONE10211024/ApiDemos

public void run() {
    mRightButton.requestFocus();
  }
});

代码示例来源:origin: luili16/UIMocker

@Override
  public void run() {
    button1.setText("I");
    button1.setFocusableInTouchMode(true);
    button1.requestFocus();
  }
});

代码示例来源:origin: qiubiteme/android_api_demos

public void run() {
    mRightButton.requestFocus();
  }
});

代码示例来源:origin: abrenoch/hyperion-android-grabber

@SuppressLint("StringFormatInvalid")
@Override
public void onScannerCompleted(@Nullable String foundIpAddress) {
  isScanning = false;
  if (foundIpAddress == null){
    startScanButton.setText(R.string.scanner_retry_button);
    manualSetupButton.requestFocus();
    descriptionText.setText(getString(R.string.scanner_no_results, "\uD83D\uDE29")); // 😩
  } else {
    Intent intent = new Intent(this, ScanResultActivity.class);
    intent.putExtra(ScanResultActivity.EXTRA_RESULT_HOST_NAME, foundIpAddress);
    intent.putExtra(ScanResultActivity.EXTRA_RESULT_PORT, String.valueOf(NetworkScanner.PORT));
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);
    finish(); // Finish the current activity
  }
}

代码示例来源:origin: OceanLabs/Android-Print-SDK

mProceedButton.requestFocus();

代码示例来源:origin: GeoODK/collect

@Override
public void setFocus(Context context) {
  // Put focus on text input field and display soft keyboard if appropriate.
  InputMethodManager inputManager =
    (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
  if ( mHasExApp ) {
    // hide keyboard
    inputManager.hideSoftInputFromWindow(mAnswer.getWindowToken(), 0);
    // focus on launch button
    mLaunchIntentButton.requestFocus();
  } else {
    if (!mPrompt.isReadOnly()) {
      mAnswer.requestFocus();
      inputManager.showSoftInput(mAnswer, 0);
      /*
       * If you do a multi-question screen after a "add another group" dialog, this won't
       * automatically pop up. It's an Android issue.
       *
       * That is, if I have an edit text in an activity, and pop a dialog, and in that
       * dialog's button's OnClick() I call edittext.requestFocus() and
       * showSoftInput(edittext, 0), showSoftinput() returns false. However, if the edittext
       * is focused before the dialog pops up, everything works fine. great.
       */
    } else {
      inputManager.hideSoftInputFromWindow(mAnswer.getWindowToken(), 0);
    }
  }
}

代码示例来源:origin: ogarcia/opensudoku

b.requestFocus();
} else {
  b.setTextAppearance(mContext, android.R.style.TextAppearance_Widget_Button);

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

相关文章

Button类方法