【发布时间】:2020-12-17 16:14:08
【问题描述】:
如标题所说,我的setError图标和endIconMode融合为一体
基本上我希望 endIconMode 在左边或右边一点。我该怎么做?
这里是 Java:
private void userLogin() {
String password = passwordEditText.getText().toString().trim();
if (password.length() < 6) {
passwordEditText.setError("Erorr Message" );
passwordEditText.requestFocus();
return;
}
这里是xml:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textPasswordField"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:hint="Inserisci la Password!"
app:boxBackgroundMode="outline"
app:boxCornerRadiusBottomEnd="16dp"
app:boxCornerRadiusBottomStart="16dp"
app:boxCornerRadiusTopEnd="16dp"
app:boxCornerRadiusTopStart="16dp"
app:endIconMode="password_toggle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.55"
app:startIconDrawable="@drawable/icons8_key_24">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/passwordEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
【问题讨论】:
标签: java xml android-studio