1

With an EditText it is possible to add an entry to support alphanumeric digits like the following:

android:digits="@string/alphanumeric_allowed_chars_free_textentry"

Where the string is defined as

<string name="alphanumeric_allowed_chars_free_textentry">
    ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=[];,./~!@#$%^</string>

However, as others have noted, when a user sets the digits attribute, it can cause the "enter" button to show a return arrow instead of a next or done button, as described in this related question

The typical solution to get done to show up is to set android:singleLine="true" and android:imeOptions="actionDone", but this will only work for an input box which is not a multi-line box. I have a multi-line edit text and would like to be able to add a done button and also fliter using the digits attribute.

Does anyone know how to allow an EditText to use digits while also being multiline, while also allowing the return button to show "done"? Android 4.4

Community
  • 1
  • 1
CrimsonX
  • 9,048
  • 9
  • 41
  • 52

2 Answers2

0

What if you modify alphanumeric_allowed_chars_free_textentry to include carriage return (\r, \n)?

0

i was unable to reply / comment to your comment So added new answer

in multiline edittext after adding \r\n to my digits property android:digits="1234567890@$%^&*()_+-=qwertyuiopasdfghjklzxcvbnm:;,.?/|~`{}[]QWERTYUIOPASDFGHJKLZXCVBNM+x÷x€£¥₩×\r\n ●■□⊙☆¤•°《》¿¡\"

i am able to goto nextline on enter as well using the digits property. below is my axml code "

i was unable to reply / comment to your comment

in multiline edittext after adding \r\n to my digits property android:digits="1234567890@$%^&*()_+-=qwertyuiopasdfghjklzxcvbnm:;,.?/|~`{}[]QWERTYUIOPASDFGHJKLZXCVBNM+x÷x€£¥₩×\r\n ●■□⊙☆¤•°《》¿¡\"

i am able to goto nextline as well using the digits property . "

<EditText                
                android:id="@+id/NewTask_TaskDescription"
                style="@style/MultiLineTextboxStyle"
                android:layout_marginBottom="10dp"
                android:layout_height="151dp"
                android:layout_width="match_parent"
                android:inputType="textCapSentences|textMultiLine"
                android:singleLine="false"
                        android:digits="1234567890@$%^&amp;*()_+-=qwertyuiopasdfghjklzxcvbnm:;,.?/|~`{}[]QWERTYUIOPASDFGHJKLZXCVBNM+x÷x€£¥₩×\r\n ●■□⊙☆¤•°《》¿¡\\" />

"

ParveZ
  • 1
  • 1
  • 3