javaandroidandroid-edittext

Errors while using MaskedEditText


I'm trying to use MaskedEditText for the phone number. This is the xml code:

 <br.com.sapereaude.maskedEditText.MaskedEditText
    android:id="@+id/phone"
android:inputType="number"
    android:layout_width="200dp"
    android:layout_marginTop="10dp"
    android:layout_height="wrap_content"
    android:hint="Phone number"
    app:met_mask="+## (###) ### ## ##"
android:maxLength="13"
    android:textAlignment="center"
    android:textSize="20dp"
    />''

What I added to grade:

implementation 'ru.egslava:MaskedEditText:1.0.5'

And the errors are:

error: attribute met_mask (aka com.example.app2:met_mask) not found. error: failed linking file resources.

Please help me!


Solution

  • According to the library which you are using https://github.com/egslava/edittext-mask,

    <br.com.sapereaude.maskedEditText.MaskedEditText
    android:id="@+id/phone_input"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:inputType="phone"
    android:typeface="monospace"
    mask:allowed_chars="1234567890"
    mask:mask="+7(###)###-##-##"
    android:hint="1234567890"
    app:keep_hint="true"
    />  
    

    You are using the property:

    app:met_mask="+## (###) ### ## ##"
    

    but library allows:

      mask:mask="+7(###)###-##-##"
    

    So, please use it accordingly as it is specified.

    Hope it will work!!!