Open Zayed007 opened 6 years ago
I'm also facing the same issue
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);
}
});
I have this issue as well.
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()
}
}
}
}
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?
<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">