HITGIF / TextFieldBoxes

Material Design text field that comes in a box, based on (OLD) Google Material Design guidelines.
Apache License 2.0
774 stars 113 forks source link

Keyboard appears after tapping editText twice. #84

Open Zayed007 opened 6 years ago

Zayed007 commented 6 years ago

<studio.carbonylgroup.textfieldboxes.TextFieldBoxes android:id="@+id/text_field_boxes1" android:layout_width="match_parent" android:layout_height="wrap_content" app:labelText="Title" app:maxCharacters="20">

        <studio.carbonylgroup.textfieldboxes.ExtendedEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:imeOptions="actionNext"
            android:inputType="text"
            android:maxLines="1"
            android:text="@string/title" />

    </studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
PemmasaniRajesh commented 5 years ago

I'm also facing the same issue

rohitshahane93 commented 5 years ago

I updated the following code in the TextFieldBoxes.java, now its working fine

this.editText.setDefaultOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean b) { if (b){ setHasFocus(true); inputMethodManager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); mainBody.performClick(); } else setHasFocus(false); } });

thevoiceless commented 5 years ago

I have this issue as well.

thevoiceless commented 5 years ago

Thanks to @rohitshahane93 for the workaround. It's also possible to extend TextFieldBoxes like so:

class FixedTextFieldBoxes @JvmOverloads constructor(
        context: Context,
        attrs: AttributeSet? = null
) : TextFieldBoxes(context, attrs) {

    override fun onFinishInflate() {
        super.onFinishInflate()

        editText.setOnFocusChangeListener { view, hasFocus ->
            setHasFocus(hasFocus)
            if (hasFocus) {
                inputMethodManager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT)
                this@FixedTextFieldBoxes.performClick()
            }
        }
    }
}
miladyalda commented 5 years ago

Thanks to @rohitshahane93 for the workaround. It's also possible to extend TextFieldBoxes like so:

class FixedTextFieldBoxes @JvmOverloads constructor(
        context: Context,
        attrs: AttributeSet? = null
) : TextFieldBoxes(context, attrs) {

    override fun onFinishInflate() {
        super.onFinishInflate()

        editText.setOnFocusChangeListener { view, hasFocus ->
            setHasFocus(hasFocus)
            if (hasFocus) {
                inputMethodManager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT)
                this@FixedTextFieldBoxes.performClick()
            }
        }
    }
}

Hello i have same problem and i can't change the source code, could you write your example in java please?