Android: How to apply android:inputType globally on all EditText

android, mobile

Solution

you can create an custom edittext and use this customview in your layouts

package com.talha.examples;
import android.content.Context;
import android.text.InputType;
import android.util.AttributeSet;
import android.widget.EditText;

public class CustomEditText extends EditText {

    public CustomEditText(Context context, AttributeSet attrs) {
        super(context, attrs);


    }

    @Override
    public void setInputType(int type) {
        // TODO Auto-generated method stub
        super.setInputType(InputType.TYPE_CLASS_TEXT);
    }
}

<com.talha.examples.CustomEditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

Problem

how do I globally turn off auto-suggestions on all EditTexts of an application? In other words, how do I do this `android:inputType="text"` on all EditText? ``` <EditText android:id="@+id/et1" android:inputType="text"> </EditText> ```

Original source