本文整理汇总了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();
}
});
}
示例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;
}
示例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;
}
示例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();
}
});
}
示例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();
}
});
}
示例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);
}
}
示例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();
}
}
示例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;
}
}
示例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();
}
});
}
示例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("");
}
});
}
示例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);
}
示例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);
}
示例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();
}
}
}
示例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;
}
});
}
}