В моем файле xml
у меня есть поле пароля TextInputEditText
, которое использует пользовательский PasswordTransformationMethod
, чтобы показать самые большие точки, когда пароль скрыт:
public class MyPasswordTransformationMethod extends PasswordTransformationMethod {
@Override
public CharSequence getTransformation(CharSequence source, View view) {
return new PasswordCharSequence(source);
}
private class PasswordCharSequence implements CharSequence {
private CharSequence mSource;
public PasswordCharSequence(CharSequence source) {
mSource = source; // Store char sequence
}
public char charAt(int index) {
return '⬤';
}
public int length() {
return mSource.length(); // Return default
}
public CharSequence subSequence(int start, int end) {
return mSource.subSequence(start, end); // Return default
}
}
}; text.setTransformationMethod(new MyPasswordTransformationMethod());
Первые маркерыбольше, но при нажатии на видимость, чтобы увидеть пароль и скрыть его снова, точки становятся меньше.Как я могу изменить его, чтобы всегда использовать символ, определенный в MyPasswordTransformationMethod?.
<android.support.design.widget.TextInputLayout
android:id="@+id/textInput_create_pass"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:passwordToggleEnabled="true"
app:passwordToggleTint="@color/colorBlue">
<android.support.design.widget.TextInputEditText
android:id="@+id/edit_create_pass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
style="@style/EditText.Password"
android:text=""
android:letterSpacing="0.5"
android:maxLength="6"
android:textSize="30dp"
android:background="@drawable/rounded_background"
/>
Спасибо -