I would like to create an EditText which accepts only numbers, has a maximum of 4 numbers, and is never narrower than it would be if filled with 4 numbers (does not shrink
One rarely-used (AFAIK) attribute of an EditText that you can use is:
android:ems="4"
This makes the EditText exactly 4 ems wide. An em width is the width of the widest (M) character in the selected font.