当前位置: 首页>>代码示例>>Java>>正文


Java TextInputLayout类代码示例

本文整理汇总了Java中android.support.design.widget.TextInputLayout的典型用法代码示例。如果您正苦于以下问题:Java TextInputLayout类的具体用法?Java TextInputLayout怎么用?Java TextInputLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TextInputLayout类属于android.support.design.widget包,在下文中一共展示了TextInputLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.support.design.widget.TextInputLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_register);

    editText = (EditText) findViewById(R.id.editText);
    spinner = (Spinner) findViewById(R.id.spinner);
    textInputLayout = (TextInputLayout) findViewById(R.id.textInputLayout);

    ArrayAdapter<CharSequence> arrayAdapter = ArrayAdapter.createFromResource(this, R.array.countries, R.layout.spinner_layout);
    arrayAdapter.setDropDownViewResource(R.layout.spinner_layout);
    spinner.setAdapter(arrayAdapter);

    AppCompatButton appCompatButton = (AppCompatButton) findViewById(R.id.button);
    appCompatButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            register();
        }
    });

}
 
开发者ID:kunalrmhatre,项目名称:fussroll,代码行数:23,代码来源:RegisterActivity.java

示例2: onCreateView

import android.support.design.widget.TextInputLayout; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    //noinspection ConstantConditions
    getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    View view = inflater.inflate(R.layout.dialog_edit_item, container, false);

    mTilValue = (TextInputLayout) view.findViewById(R.id.tilValue);
    mEtValue = (TextInputEditText) view.findViewById(R.id.etValue);

    view.findViewById(R.id.bPositive).setOnClickListener(this);
    view.findViewById(R.id.bNegative).setOnClickListener(this);

    return view;
}
 
开发者ID:Cleveroad,项目名称:AdaptiveTableLayout,代码行数:17,代码来源:EditItemDialog.java

示例3: gatherFormData

import android.support.design.widget.TextInputLayout; //导入依赖的package包/类
private Map<String, String> gatherFormData() {
  final ViewGroup formContainer = this.formContainer;
  final int childCount = formContainer.getChildCount();
  final ArrayMap<String, String> formData = new ArrayMap<>(childCount);
  for (int i = 0; i < childCount; i++) {
    final View child = formContainer.getChildAt(i);
    final PacketParameter param = (PacketParameter) child.getTag();
    if (child instanceof TextInputLayout) {
      final EditText input = ((TextInputLayout) child).getEditText();
      if (input != null) {
        formData.put(param.id(), input.getText().toString());
      }
    }
  }
  final Packet selectedPacket = Packet.fromSelection(packetSelection.getSelectedItemPosition());
  formData.put(PACKET_ID_KEY, Integer.toString(selectedPacket.packetId));
  formData.put(DATETIME_KEY, DATE_FORMAT.format(new Date()));
  return formData;
}
 
开发者ID:swedbank,项目名称:android-banklink,代码行数:20,代码来源:MainActivity.java

示例4: setupViews

import android.support.design.widget.TextInputLayout; //导入依赖的package包/类
private void setupViews() {
        textInput_nom      = (TextInputLayout) findViewById(R.id.textInput_supname);
        textInput_email    = (TextInputLayout) findViewById(R.id.textInput_email);
        textInput_addresse = (TextInputLayout) findViewById(R.id.textInput_SupAdresse);
        textInput_mobile   = (TextInputLayout) findViewById(R.id.textInput_mobile);
        textInput_tel      = (TextInputLayout) findViewById(R.id.textInput_telephone);
        Button button_ajouter = (Button) findViewById(R.id.button_ajouter);
        button_ajouter.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(!checkFields())
                    Toast.makeText(AjouteSupplierActivity.this, "Erreur", Toast.LENGTH_SHORT).show();
                else
                    addSupplier();
            }
        });
}
 
开发者ID:ayounes3333,项目名称:GSB-2017-Android,代码行数:18,代码来源:AjouteSupplierActivity.java

示例5: setupViews

import android.support.design.widget.TextInputLayout; //导入依赖的package包/类
private void setupViews() {
    textInput_Code_user     = (TextInputLayout) findViewById(R.id.textInput_Code_user);
    textInput_FullName      = (TextInputLayout) findViewById(R.id.textInput_FullName);
    textInput_TelUsr        = (TextInputLayout) findViewById(R.id.textInput_TelUsr);
    textInput_AdrUsr        = (TextInputLayout) findViewById(R.id.textInput_AdrUsr);
    textView_Password1      = (TextInputLayout) findViewById(R.id.textView_Password1);
    textView_Password2      = (TextInputLayout) findViewById(R.id.textView_Password2);
    spinner_branch          = (Spinner) findViewById(R.id.spinner_branch);

    Button button_register = (Button) findViewById(R.id.button_ajouter);

    button_register.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if(!checkFields())
                Toast.makeText(RegisterActivity.this, "Erreur", Toast.LENGTH_SHORT).show();
            else
                Register();
        }
    });
}
 
开发者ID:ayounes3333,项目名称:GSB-2017-Android,代码行数:22,代码来源:RegisterActivity.java

示例6: process

import android.support.design.widget.TextInputLayout; //导入依赖的package包/类
@Override
public void process(@NonNull Context context, @Nullable String key, @NonNull View view, @NonNull String suffix) {
    final TextView tv = (TextView) view;
    final ColorResult result = getColorFromSuffix(context, key, view, suffix);
    if (result == null) return;

    if (mHintMode)
        result.adjustAlpha(0.5f);

    final ColorStateList sl = getTextSelector(result.getColor(), view, false);
    if (mLinkMode) {
        tv.setLinkTextColor(sl);
    } else if (mHintMode) {
        tv.setHintTextColor(sl);
        // Sets parent TextInputLayout hint color
        if (view.getParent() != null && view.getParent() instanceof TextInputLayout) {
            final TextInputLayout til = (TextInputLayout) view.getParent();
            TextInputLayoutUtil.setHint(til, result.getColor());
        }
    } else {
        tv.setTextColor(sl);
    }
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:24,代码来源:TextColorTagProcessor.java

示例7: init

import android.support.design.widget.TextInputLayout; //导入依赖的package包/类
private void init() {
    try {
        Field cthField = TextInputLayout.class.getDeclaredField("mCollapsingTextHelper");
        cthField.setAccessible(true);
        collapsingTextHelper = cthField.get(this);


        Field boundsField = collapsingTextHelper.getClass().getDeclaredField("mCollapsedBounds");
        boundsField.setAccessible(true);
        bounds = (Rect) boundsField.get(collapsingTextHelper);

        recalculateMethod = collapsingTextHelper.getClass().getDeclaredMethod("recalculate");

    } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException e) {
        collapsingTextHelper = null;
        bounds = null;
        recalculateMethod = null;
        e.printStackTrace();
    }
}
 
开发者ID:aksalj,项目名称:africastalking-android,代码行数:21,代码来源:CardTextInputLayout.java

示例8: initViews

import android.support.design.widget.TextInputLayout; //导入依赖的package包/类
private void initViews(View v) {

        mEtEmail = (EditText) v.findViewById(R.id.et_email);
        mEtToken = (EditText) v.findViewById(R.id.et_token);
        mEtPassword = (EditText) v.findViewById(R.id.et_password);
        mBtResetPassword = (Button) v.findViewById(R.id.btn_reset_password);
        mProgressBar = (ProgressBar) v.findViewById(R.id.progress);
        mTvMessage = (TextView) v.findViewById(R.id.tv_message);
        mTiEmail = (TextInputLayout) v.findViewById(R.id.ti_email);
        mTiToken = (TextInputLayout) v.findViewById(R.id.ti_token);
        mTiPassword = (TextInputLayout) v.findViewById(R.id.ti_password);

        mBtResetPassword.setOnClickListener(view -> {
            if (isInit) resetPasswordInit();
            else resetPasswordFinish();
        });
    }
 
开发者ID:EdwardAlexis,项目名称:Sistema-de-Comercializacion-Negocios-Jhordan,代码行数:18,代码来源:ResetPasswordDialog.java

示例9: compararFechaHora

import android.support.design.widget.TextInputLayout; //导入依赖的package包/类
public static boolean compararFechaHora(EditText f1, EditText h1, String fec1, String fec2){
    Log.d("FECHAS", fec1 + "     " + fec2);
    Date d1 = DateUtilities.stringToDate(fec1);
    Date d2 = DateUtilities.stringToDate(fec2);

    if(d2.before(d1)){
        ((TextInputLayout)f1.getParent().getParent()).setErrorEnabled(true);
        ((TextInputLayout)f1.getParent().getParent()).setError("La fecha de fin no puede ser posterior a la de inicio.");
        ((TextInputLayout)h1.getParent().getParent()).setErrorEnabled(true);
        ((TextInputLayout)h1.getParent().getParent()).setError("");
        return false;
    }
    else{
        return true;
    }
}
 
开发者ID:ur13l,项目名称:Guanajoven,代码行数:17,代码来源:EditTextValidations.java

示例10: onCreate

import android.support.design.widget.TextInputLayout; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sunny_run);
    usernameText = (TextInputLayout) findViewById(R.id.sunny_run_username_edit_text);
    listTopText = (TextView) findViewById(R.id.sun_list_top_text);
    loginButton = (Button) findViewById(R.id.sunny_run_login_button);
    refreshLayout = (SwipeRefreshLayout) findViewById(R.id.sunny_refresh);
    loginLayout = (LinearLayout) findViewById(R.id.sunny_run_login_layout);
    setToolbar(R.id.sunny_run_toolbar, true);
    refreshLayout.setEnabled(false);

    initRecyclerView();
    checkLogin();

    loginButton.setOnClickListener(v -> {
        //收回输入法
        InputMethodManager imm = (InputMethodManager)
                getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(refreshLayout.getWindowToken(), 0);
        if (checkInput()) {
            prefs.put("sunny_run_username", usernameText.getEditText().getText().toString());
            getData();
        }
    });
}
 
开发者ID:SailFlorve,项目名称:RunHDU,代码行数:27,代码来源:SunnyRunActivity.java

示例11: setCancelAction

import android.support.design.widget.TextInputLayout; //导入依赖的package包/类
private void setCancelAction(Button cancelButton, final EditText dateEditText,
                             final EditText timeEditText, final TextInputLayout... textInputLayouts) {
    cancelButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            for (TextInputLayout textInputLayout : textInputLayouts) {
                textInputLayout.getEditText().setText("");
                textInputLayout.clearFocus();
                // Hide the keyboard
                InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(textInputLayout.getEditText().getWindowToken(), 0);
            }
            dateEditText.setText("");
            timeEditText.setText("");
        }
    });
}
 
开发者ID:kflauri2312lffds,项目名称:Android_watch_magpie,代码行数:18,代码来源:AddValueFragment.java

示例12: setUp

import android.support.design.widget.TextInputLayout; //导入依赖的package包/类
@Before
public void setUp() {
	MockitoAnnotations.initMocks(this);
	setupActivity = Robolectric.setupActivity(TestSetupActivity.class);
	nicknameEntryWrapper = (TextInputLayout) setupActivity
			.findViewById(R.id.nickname_entry_wrapper);
	passwordConfirmationWrapper = (TextInputLayout) setupActivity
			.findViewById(R.id.password_confirm_wrapper);
	nicknameEntry =
			(EditText) setupActivity.findViewById(R.id.nickname_entry);
	passwordEntry =
			(EditText) setupActivity.findViewById(R.id.password_entry);
	passwordConfirmation =
			(EditText) setupActivity.findViewById(R.id.password_confirm);
	strengthMeter =
			(StrengthMeter) setupActivity.findViewById(R.id.strength_meter);
	createAccountButton =
			(Button) setupActivity.findViewById(R.id.create_account);
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:20,代码来源:SetupActivityTest.java

示例13: setUp

import android.support.design.widget.TextInputLayout; //导入依赖的package包/类
@Before
public void setUp() {
	MockitoAnnotations.initMocks(this);
	changePasswordActivity =
			Robolectric.setupActivity(TestChangePasswordActivity.class);
	passwordConfirmationWrapper = (TextInputLayout) changePasswordActivity
			.findViewById(R.id.new_password_confirm_wrapper);
	currentPassword = (EditText) changePasswordActivity
			.findViewById(R.id.current_password_entry);
	newPassword = (EditText) changePasswordActivity
			.findViewById(R.id.new_password_entry);
	newPasswordConfirmation = (EditText) changePasswordActivity
			.findViewById(R.id.new_password_confirm);
	strengthMeter = (StrengthMeter) changePasswordActivity
			.findViewById(R.id.strength_meter);
	changePasswordButton = (Button) changePasswordActivity
			.findViewById(R.id.change_password);
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:19,代码来源:ChangePasswordActivityTest.java

示例14: onClick

import android.support.design.widget.TextInputLayout; //导入依赖的package包/类
@Override
public void onClick(View v) {
    TextInputLayout tilUsername = (TextInputLayout) findViewById(R.id.TILUsername);
    TextInputLayout tilPassword = (TextInputLayout) findViewById(R.id.TILPassword);

    final String strUsername = etUsername.getText().toString();
    final String strPassword = etPassword.getText().toString();

    if (v.equals(btnLogin)){
        if (strUsername.equals("")){
            tilUsername.setError("Kullanıcı adı boş olamaz.");
        }else if (strPassword.equals("")){
            tilPassword.setError("Parola adı boş olamaz.");
        }else{

            Request request = new Request(this, url, com.android.volley.Request.Method.POST);
            request.requestVolleyAuth(this,  strUsername,  strPassword);
            progressDialog = new ProgressDialog(this);
            progressDialog.setMessage("Giriş Yapılıyor..");
            progressDialog.show();

        }
    }
}
 
开发者ID:yusufcakal,项目名称:RestaurantApp,代码行数:25,代码来源:StaffLoginActivity.java

示例15: removeFocus

import android.support.design.widget.TextInputLayout; //导入依赖的package包/类
private void removeFocus(TextInputLayout... textInputLayouts) {
    for (TextInputLayout textInputLayout : textInputLayouts) {
        textInputLayout.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
                if (actionId == EditorInfo.IME_ACTION_DONE) {
                    textView.clearFocus();
                    // Hide the keyboard
                    InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
                    imm.hideSoftInputFromWindow(textView.getWindowToken(), 0);
                }
                return false;
            }
        });
    }
}
 
开发者ID:kflauri2312lffds,项目名称:Android_watch_magpie,代码行数:17,代码来源:AddValueFragment.java


注:本文中的android.support.design.widget.TextInputLayout类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。