Reputation: 1537
I want my EditText for input exactly x (x=13) signs (digits) and I want it to have that width prepared from scratch. I don't want it to extend while typing or be overextended. It has to be fixed. I read another stackoverflow issue
and used solution with setting ems=13 but then EditText is still wider (like 2x) than for 13 digits. How to solve my problem ?
<EditText
android:id="@+id/barcode_manual_edit"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:inputType="number"
android:ems="13"
android:maxLength="13"
/>
Upvotes: 2
Views: 1931
Reputation: 1007554
In addition to playing with things like android:ems
, you will need to set the android:typeface
to be monospace
. Otherwise, characters themselves are varying widths, and you cannot achieve "exactly x (x=13) signs (digits)".
Upvotes: 1