當前位置: 首頁>>代碼示例>>Java>>正文


Java TextInputEditText.requestFocus方法代碼示例

本文整理匯總了Java中android.support.design.widget.TextInputEditText.requestFocus方法的典型用法代碼示例。如果您正苦於以下問題:Java TextInputEditText.requestFocus方法的具體用法?Java TextInputEditText.requestFocus怎麽用?Java TextInputEditText.requestFocus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.design.widget.TextInputEditText的用法示例。


在下文中一共展示了TextInputEditText.requestFocus方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import android.support.design.widget.TextInputEditText; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    // Set up the login form.
    mServerView = (TextInputEditText) findViewById(R.id.server);
    mUsernameView = (TextInputEditText) findViewById(R.id.user);
    mPasswordView = (TextInputEditText) findViewById(R.id.password);
    mSignInButton = (Button) findViewById(R.id.user_sign_in_button);
    mLoginFormView = findViewById(R.id.login_form);
    mProgressView = findViewById(R.id.login_progress);

    addListenerOnButton();
    mUsernameView.requestFocus();
}
 
開發者ID:DecentralizedAmateurPagingNetwork,項目名稱:DAPNETApp,代碼行數:17,代碼來源:LoginActivity.java

示例2: validateInputs

import android.support.design.widget.TextInputEditText; //導入方法依賴的package包/類
private boolean validateInputs() {
    boolean valid = true;
    // Validates title (required field, ensure title is given.)
    TextInputLayout titleWrapper = getView().findViewById(R.id.edit_title_wrapper);
    TextInputEditText title = getView().findViewById(R.id.edit_title);

    if (title.getText().toString().isEmpty()) {
        titleWrapper.setErrorEnabled(true);
        titleWrapper.setError("This field is required.");
        title.requestFocus();
        myActivity.hideSoftKeyboard(false);
        valid = false;
    } else {
        titleWrapper.setError(null);
        titleWrapper.setErrorEnabled(false);
    }

    // Validates due_date (must be later than now.)
    TextInputLayout timeWrapper = getView().findViewById(R.id.edit_time_wrapper);
    TextInputEditText time = getView().findViewById(R.id.edit_time);
    long date_time = myCalendar.getTimeInMillis();
    long current_date_time = System.currentTimeMillis();
    if (date_time < current_date_time){
        timeWrapper.setErrorEnabled(true);
        timeWrapper.setError("Please select a time later than now");
        time.requestFocus();
        valid = false;
    } else {
        time.setError(null);
        timeWrapper.setErrorEnabled(false);
    }

    return valid;
}
 
開發者ID:danlls,項目名稱:Todule-android,代碼行數:35,代碼來源:ToduleAddFragment.java

示例3: defineObjects

import android.support.design.widget.TextInputEditText; //導入方法依賴的package包/類
private void defineObjects() {
    message = (TextInputEditText) findViewById(R.id.post_call_text);
    Switch emergency = (Switch) findViewById(R.id.post_call_emergencyswitch);
    String m = user.toUpperCase();
    m += ": ";
    message.setText(m);
    message.requestFocus();
    emergency.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            emergencyBool = isChecked;
        }
    });
}
 
開發者ID:DecentralizedAmateurPagingNetwork,項目名稱:DAPNETApp,代碼行數:15,代碼來源:PostCallActivity.java

示例4: setFieldError

import android.support.design.widget.TextInputEditText; //導入方法依賴的package包/類
protected void setFieldError(TextInputEditText field, String message) {
    BaseAuthViewState vs = (BaseAuthViewState<RegistrationView>) viewState;
    vs.setShowForm();

    setFormEnabled(true);
    field.setError(message);
    field.requestFocus();
    textViewFailure.setVisibility(View.GONE);
    signUpProgressBar.setVisibility(View.GONE);
}
 
開發者ID:blstream,項目名稱:StudyBox_Android,代碼行數:11,代碼來源:RegistrationActivity.java

示例5: setFieldError

import android.support.design.widget.TextInputEditText; //導入方法依賴的package包/類
@Override
protected void setFieldError(TextInputEditText field, String message) {
    BaseAuthViewState vs = (BaseAuthViewState<LoginView>) viewState;
    vs.setShowForm();

    setFormEnabled(true);
    field.setError(message);
    field.requestFocus();
    authErrorView.setVisibility(View.GONE);
    loginProgressBar.setVisibility(View.GONE);
}
 
開發者ID:blstream,項目名稱:StudyBox_Android,代碼行數:12,代碼來源:LoginActivity.java

示例6: hasText

import android.support.design.widget.TextInputEditText; //導入方法依賴的package包/類
public static boolean hasText(Context context, TextInputEditText editText) {

        String text = editText.getText().toString().trim();
        if (text.isEmpty()) {
            editText.requestFocus();
            editText.setError(context.getString(R.string.edittext_error));
        }

        return !text.isEmpty();
    }
 
開發者ID:Microsoft,項目名稱:Cognitive-TextAnalytics-Android,代碼行數:11,代碼來源:Utils.java

示例7: setFocused

import android.support.design.widget.TextInputEditText; //導入方法依賴的package包/類
@BindingAdapter("focused")
public static void setFocused(TextInputEditText editText, boolean requestFocus) {
    if (requestFocus)
        editText.requestFocus();
}
 
開發者ID:MLSDev,項目名稱:RecipeFinderJavaVersion,代碼行數:6,代碼來源:DataBinder.java


注:本文中的android.support.design.widget.TextInputEditText.requestFocus方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。