目前我正在为密码输入实现自定义textView。我使用自定义转换来显示最后输入的数字,如下所示:
public class PinCodePasswordTransformationMethod extends PasswordTransformationMethod {
char passwordBullet = '\u26aa';
@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) {
if(index != mSource.length()-1)
return passwordBullet;
else
return mSource.charAt(index);
}
public int length() {
return mSource.length(); // Return default
}
public CharSequence subSequence(int start, int end) {
return mSource.subSequence(start, end); // Return default
}
}
}
并将其应用于textview,如下所示:
mTextView.setTransformationMethod(new PinCodePasswordTransformationMethod());
现在每个字母在输入时立即出现。如何为更改设置动画,以便为新的密码输入和密码子弹字符的倒数第二个更改动画?