Android Custom TextInput Layout with Hint text and Placeholder are overlapping

38 views Asked by At

I'm facing a weird issue while using a custom TextInputLayout where i have both hint text and placeholder text, in general scenario when the focus comes on the edit text then hint text float up and placeholder text display in the edit text but in a scenario where the focus is on edit text and app goes in the background and then comes to foreground then HintText and PlaceHolder Text is overlapping.

Please see below image for reference: enter image description here

Code snippet XML layout:

<com.deliverysdk.core.ui.ABCTextInputLayout

         android:id="@+id/et_mobile_input_layout"
         android:layout_width="match_parent"
         android:layout_height="56dp"
         android:layout_marginTop="16dp"
         android:clickable="true"
         android:focusable="true"              
   android:hint="@string/app_global_user_info_profile_mobile_num_txt"                  app:hintTextAppearance="@style/TextInputLayoutHintText"
         app:hintTextColor="@color/global_mine_shaft_600"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent"           
app:placeholderTextAppearance="@style/TextInputLayoutPlaceHolderText>

                    <com.deliverysdk.core.ui.GPEditText
                        android:id="@+id/et_mobile"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:imeOptions="actionSend"
                        android:importantForAutofill="no"
                        android:inputType="phone"
                        android:nextFocusDown="@id/et_email"
                        android:singleLine="true"
                        app:glb_et_error_text_view="@id/tv_phone_error"
                        app:glb_et_input_layout="@id/et_mobile_input_layout"
                        app:glb_et_prefix_color="@color/global_mine_shaft_500"
                        app:glb_et_type="clear_text" />

                </com.deliverysdk.core.ui.ABCTextInputLayout> 

Is there anyone faced the same scenario or can help me out with this. Thanks in advance.

1

There are 1 answers

0
Zafar Imam On

This issue is resolved by adding a delay while setting the placeholder on textinputlayout programmatically.