'How to restrict width of firetv input for EditText (number password) to 4 characters

Using android:maxLength="4" attribute, I am able to restrict the input into 4 digits. But still the input popup in firetv stick shows spaces for 5 digits. Customer is getting confused because of these. Any solution would be appreciated.

enter image description here

I declared the EditText in layout xml as follows.

<EditText
            android:id="@+id/pin_edit_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="numberPassword"
            android:background="@drawable/ls_edit_text_bg"
            android:layout_marginTop="20dp"
            android:textColor="@color/white"
            android:textSize="30sp"
            android:padding="10dp"
            android:maxLength="4"
            />


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source