On the soft keyboard in Android you can set the soft keyboard to show the numbers instead of a-z keyboard using android:inputType=\"numberDecimal\"
. However, wh
I had implemented this for android in Xamarin. So, my code is in C#. But the principal stays the same. You can set attribute of edittext to android:inputType="numberPassword"
.
Then within your code you attach custom transformation method to your edittext view.
holder.edtxtQty.TransformationMethod = new HiddenPasswordTransformationMethod();
private class HiddenPasswordTransformationMethod : global::Android.Text.Method.PasswordTransformationMethod
{
public override Java.Lang.ICharSequence GetTransformationFormatted(Java.Lang.ICharSequence source, View view)
{
return new PasswordCharSequence(source);
}
}
private class PasswordCharSequence : Java.Lang.Object, Java.Lang.ICharSequence
{
private char DOT = '\u2022';
private Java.Lang.ICharSequence _source;
public PasswordCharSequence(Java.Lang.ICharSequence source)
{
_source = source;
}
public char CharAt(int index)
{
return _source.CharAt(index);
}
public int Length()
{
return _source.Length();
}
public Java.Lang.ICharSequence SubSequenceFormatted(int start, int end)
{
return _source.SubSequenceFormatted(start, end); // Return default
}
public IEnumerator<char> GetEnumerator()
{
return _source.GetEnumerator();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return _source.GetEnumerator();
}
}
The phone number pad is the closest thing I've found (set inputType="phone"
on your EditText
).