Android EditText error message popup text not showing - android

I'm having an issue in my app where the error popup on EditTexts shows but the text is not visible.
It looks something like this:
This happens with all the EditTexts in my app.
Here's an example layout XML
Layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/gradient"
android:fitsSystemWindows="true"
tools:context=".ui.onboarding.profile.OnboardingUserProfileActivity">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
app:srcCompat="#drawable/shapes_background" />
<ProgressBar
android:id="#+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone" />
<ScrollView
android:id="#+id/form"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp">
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="80dp"
android:orientation="vertical">
<android.support.constraint.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="40dp"
android:layout_marginBottom="20dp">
<ImageView
android:id="#+id/profileImageView"
android:layout_width="160dp"
android:layout_height="160dp"
android:scaleType="fitXY"
android:src="#drawable/user_profile_placeholder"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<android.support.design.widget.FloatingActionButton
android:id="#+id/cameraImageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:srcCompat="#android:drawable/ic_menu_camera" />
</android.support.constraint.ConstraintLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/firstnameTvLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="20dp"
android:layout_weight="0.33"
android:textColorHint="#color/colorVeryLightGray"
android:theme="#style/AppTheme.WhiteColorAccent"
app:errorTextAppearance="#style/error_appearance">
<android.support.design.widget.TextInputEditText
android:id="#+id/firstnameTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/prompt_firstname"
android:inputType="textPersonName"
android:maxLines="1"
android:nextFocusDown="#id/lastnameTv"
android:nextFocusForward="#id/lastnameTv"
android:singleLine="true"
android:textColor="#android:color/white"
android:textColorHint="#color/colorWhite"
android:theme="#style/AppTheme.WhiteEditText"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/lastnameTvLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="20dp"
android:layout_weight="0.33"
android:textColorHint="#color/colorVeryLightGray"
android:theme="#style/AppTheme.WhiteColorAccent">
<android.support.design.widget.TextInputEditText
android:id="#+id/lastnameTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/prompt_lastname"
android:inputType="textPersonName"
android:maxLines="1"
android:nextFocusDown="#id/usernameTv"
android:nextFocusForward="#id/usernameTv"
android:singleLine="true"
android:textColor="#android:color/white"
android:textColorHint="#color/colorWhite"
android:theme="#style/AppTheme.WhiteEditText" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/usernameTvLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.33"
android:textColorHint="#color/colorVeryLightGray"
android:theme="#style/AppTheme.WhiteColorAccent">
<android.support.design.widget.TextInputEditText
android:id="#+id/usernameTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/prompt_username"
android:imeActionId="6"
android:imeActionLabel="#string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:maxLines="1"
android:nextFocusDown="#id/nextBtn"
android:nextFocusForward="#id/nextBtn"
android:singleLine="true"
android:textColor="#android:color/white"
android:textColorHint="#color/colorWhite"
android:theme="#style/AppTheme.WhiteEditText" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</ScrollView>
<Button
android:id="#+id/nextBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginTop="16dp"
android:text="#string/next"
android:textStyle="bold"
android:theme="#style/AppTheme.PrimaryButton"
app:layout_anchor="#+id/form"
app:layout_anchorGravity="bottom|center_horizontal" />
</android.support.design.widget.CoordinatorLayout>
And the styles:
<style name="AppTheme.WhiteColorAccent">
<item name="colorAccent">#color/colorWhite</item>
</style>
<style name="AppTheme.WhiteEditText" parent="Widget.AppCompat.EditText">
<item name="android:textColor">#color/colorWhite</item>
<item name="colorControlNormal">#color/colorVeryLightGray</item>
<item name="colorControlActivated">#color/colorWhite</item>
<item name="colorControlHighlight">#color/colorWhite</item>
</style>
Setting error in the activity using firstnameTv.error = "This field can not be empty" (Kotlin)

You need to use
style="#style/AppTheme.WhiteEditText"
Instead of android:theme="#style/AppTheme.WhiteColorAccent"
Now question is why need to use style Instead of android:theme
When you use style it apply will apply only to that view
and When you use android:theme it apply will apply view as well as all of its children.
Read more about What is the difference between style and android:theme attributes?
SAMPLE CODE
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/main_content"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:layout_height="match_parent"
android:background="#color/colorPrimary">
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:visibility="gone" />
<ProgressBar
android:id="#+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone" />
<ScrollView
android:id="#+id/form"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp"
android:fillViewport="true">
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="80dp"
android:orientation="vertical">
<android.support.constraint.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="40dp"
android:layout_marginBottom="20dp">
<ImageView
android:id="#+id/profileImageView"
android:layout_width="160dp"
android:layout_height="160dp"
android:scaleType="fitXY"
android:src="#color/colorNavBar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/cameraImageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:srcCompat="#android:drawable/ic_menu_camera" />
</android.support.constraint.ConstraintLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/firstnameTvLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="20dp"
android:layout_weight="0.33"
android:textColorHint="#color/colorVeryLightGray"
style="#style/AppTheme.WhiteColorAccent"
>
<android.support.design.widget.TextInputEditText
android:id="#+id/firstnameTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="First Name"
android:inputType="textPersonName"
android:maxLines="1"
android:imeOptions="actionNext"
android:nextFocusDown="#id/lastnameTv"
android:nextFocusForward="#id/lastnameTv"
android:textColor="#android:color/white"
android:textColorHint="#color/colorWhite"
style="#style/AppTheme.WhiteEditText" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/lastnameTvLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="20dp"
android:layout_weight="0.33"
android:textColorHint="#color/colorVeryLightGray"
style="#style/AppTheme.WhiteColorAccent">
<android.support.design.widget.TextInputEditText
android:id="#+id/lastnameTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Last Name"
android:inputType="textPersonName"
android:maxLines="1"
android:nextFocusDown="#id/usernameTv"
android:nextFocusForward="#id/usernameTv"
android:singleLine="true"
android:textColor="#android:color/white"
android:textColorHint="#color/colorWhite"
style="#style/AppTheme.WhiteEditText" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/usernameTvLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="20dp"
android:layout_weight="0.33"
android:textColorHint="#color/colorVeryLightGray"
style="#style/AppTheme.WhiteColorAccent">
<android.support.design.widget.TextInputEditText
android:id="#+id/usernameTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="user Name"
android:imeActionId="6"
android:imeActionLabel="AB"
android:imeOptions="actionUnspecified"
android:maxLines="1"
android:nextFocusDown="#id/nextBtn"
android:nextFocusForward="#id/nextBtn"
android:singleLine="true"
android:textColor="#android:color/white"
android:textColorHint="#color/colorWhite"
style="#style/AppTheme.WhiteEditText" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</ScrollView>
<Button
android:id="#+id/nextBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginTop="16dp"
android:text="Next"
android:textStyle="bold"
app:layout_anchor="#+id/form"
app:layout_anchorGravity="bottom|center_horizontal" />
</android.support.design.widget.CoordinatorLayout>
style
<style name="AppTheme.WhiteColorAccent">
<item name="colorAccent">#color/colorWhite</item>
</style>
<style name="AppTheme.WhiteEditText" parent="Widget.AppCompat.EditText">
<item name="android:textColor">#color/colorWhite</item>
<item name="colorControlNormal">#color/colorVeryLightGray</item>
<item name="colorControlActivated">#color/colorWhite</item>
<item name="colorControlHighlight">#color/colorWhite</item>
</style>
OUTPUT

You need to set the error in TextInputLayout, NOT in TextInputEditText
firstnameTvLayout.setError("Error goes here");
Also make sure you have done
firstnameTvLayout.setErrorEnabled(true);
See the documentation here for more details https://developer.android.com/reference/android/support/design/widget/TextInputLayout

You have to use style instead of android:theme. If you set android:theme to a view group, its children (error pop-up, in this case) will use the same style.
Your code
<android.support.design.widget.TextInputLayout
....
android:theme="#style/AppTheme.WhiteColorAccent"
....>
Change it to
<android.support.design.widget.TextInputLayout
....
style="#style/AppTheme.WhiteColorAccent"
....>

textInputLayout.setErrorEnable(true);

Related

Trying to set the EditText inside FragmentDialog to be multiline doesn't work

So I'm trying to set the edit text inside dialog to multi-lined but it doesn't do so it only appears in single-line for some reason
and it just keeps going to the right instead of going down(\n).
I set the edit text to multiline and the single line to be false but nothing works
here is the XML code for the dialog:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/item_background_gray"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0"
android:padding="8dp"
app:srcCompat="#drawable/ic_baseline_radio_button_unchecked_24"
app:tint="#66FFFFFF" />
<EditText
android:id="#+id/et_missionText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_weight="2"
android:background="#null"
android:ems="10"
android:gravity="top|left"
android:hint="Add mission"
android:importantForAutofill="no"
android:inputType="textImeMultiLine"
android:lines="8"
android:minHeight="48dp"
android:overScrollMode="always"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:scrollbars="vertical"
android:scrollHorizontally="false"
android:singleLine="false"
android:textColor="#color/white"
android:textColorHint="#B0FFFFFF" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="#+id/fab_addMission"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="0"
android:backgroundTint="#color/item_background_gray"
android:clickable="true"
android:contentDescription="#string/app_name"
android:focusable="true"
app:borderWidth="0dp"
app:fabCustomSize="40dp"
app:srcCompat="#drawable/ic_round_arrow_circle_up_24"
app:tint="#color/add_button_background_gray" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Thank you for your help.
I have checked your code and fixed the issue. You only need to remove below line from your code:
android:inputType="textImeMultiLine"
I am also posting edited code below:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/item_background_gray"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0"
android:padding="8dp"
app:srcCompat="#drawable/ic_baseline_radio_button_unchecked_24"
app:tint="#66FFFFFF" />
<EditText
android:id="#+id/et_missionText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_weight="2"
android:background="#null"
android:ems="10"
android:gravity="top|left"
android:hint="Add mission"
android:importantForAutofill="no"
android:lines="8"
android:minHeight="48dp"
android:overScrollMode="always"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:scrollbars="vertical"
android:scrollHorizontally="false"
android:singleLine="false"
android:textColor="#color/white"
android:textColorHint="#B0FFFFFF" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="#+id/fab_addMission"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="0"
android:backgroundTint="#color/item_background_gray"
android:clickable="true"
android:contentDescription="#string/app_name"
android:focusable="true"
app:borderWidth="0dp"
app:fabCustomSize="40dp"
app:srcCompat="#drawable/ic_round_arrow_circle_up_24"
app:tint="#color/add_button_background_gray" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Adjust view height to remove extra spaces in a constraint layout

Here, is how my screen looks like
Login screen
I want to remove extra spaces between the submit button and the bottom of the screen.
I researched about this issue in SO. But exactly no one answers it as far I have looked.
Can you suggest some ways to do so?
I have attached the XML layout below for reference.
Login layout
<?xml version="1.0" encoding="utf-8"?>
<layout>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorAccent"
tools:context=".MainActivity">
<View
android:id="#+id/view_form"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintVertical_weight="0.50"
android:layout_marginTop="#dimen/marginTopLogin"
android:background="#drawable/round_cornered_top_white_bg_drawable"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<EditText
android:id="#+id/etUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:autofillHints="name"
android:hint="Username"
android:imeOptions="actionNext"
android:inputType="text"
android:maxLines="1"
android:padding="16dp"
app:layout_constraintEnd_toEndOf="#id/view_form"
app:layout_constraintStart_toStartOf="#id/view_form"
app:layout_constraintTop_toTopOf="#+id/view_form" />
<EditText
android:id="#+id/etPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:autofillHints="password"
android:hint="Password"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:maxLines="1"
android:padding="16dp"
app:layout_constraintEnd_toEndOf="#id/view_form"
app:layout_constraintStart_toStartOf="#id/view_form"
app:layout_constraintTop_toBottomOf="#+id/etUsername"/>
<CheckBox
android:id="#+id/imgTogglePassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-5dp"
android:layout_marginEnd="-5dp"
android:button="#drawable/btn_toggle_password"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="#id/etPassword"
app:layout_constraintEnd_toEndOf="#id/etPassword"
app:layout_constraintTop_toTopOf="#id/etPassword" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit"
android:layout_marginTop="20dp"
android:background="#color/colorAccent"
app:layout_constraintTop_toBottomOf="#id/etPassword"
app:layout_constraintStart_toStartOf="#id/view_form"
app:layout_constraintEnd_toEndOf="#id/view_form"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
try it
<layout>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorAccent"
tools:context=".MainActivity">
<View
android:id="#+id/view_form"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="#dimen/marginTopLogin"
android:background="#drawable/round_cornered_top_white_bg_drawable"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_weight="0.50" />
<EditText
android:id="#+id/etUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:autofillHints="name"
android:hint="Username"
android:imeOptions="actionNext"
android:inputType="text"
android:maxLines="1"
android:padding="16dp"
app:layout_constraintEnd_toEndOf="#id/view_form"
app:layout_constraintStart_toStartOf="#id/view_form"
app:layout_constraintTop_toTopOf="#+id/view_form" />
<EditText
android:id="#+id/etPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:autofillHints="password"
android:hint="Password"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:maxLines="1"
android:padding="16dp"
app:layout_constraintEnd_toEndOf="#id/view_form"
app:layout_constraintStart_toStartOf="#id/view_form"
app:layout_constraintTop_toBottomOf="#+id/etUsername" />
<CheckBox
android:id="#+id/imgTogglePassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-5dp"
android:layout_marginEnd="-5dp"
android:button="#drawable/btn_toggle_password"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="#id/etPassword"
app:layout_constraintEnd_toEndOf="#id/etPassword"
app:layout_constraintTop_toTopOf="#id/etPassword" />
<androidx.appcompat.widget.AppCompatButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:text="Submit"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

Android - Scale Image to status bar of the phone

Simply, I have a linear layout that separates the screen to 2 pieces from middle and in the first piece I have a constraint layout that contains mountain.png .Because of i set NoActionBar and white for statusBarColor in Themes.xml, as a result above the image there is area that seems white.So I want to remove the white area and scale the image through status bar of the phone.
I tried to remove status bar, it didn't work.
I tried to add android:fitsSystemWindows="true" attribute to .XML file and it didn't work too.
My .xml file
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.sign_in.telephone.PhoneNumberFragment"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="5"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:background="#drawable/mountain">
<TextView
android:id="#+id/baslaText"
android:layout_width="match_parent"
android:gravity="center"
android:layout_marginTop="100dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginLeft="100dp"
android:layout_marginRight="100dp"
android:layout_height="wrap_content"
android:textSize="38sp"
android:textColor="#color/white"
android:text="Başlayın" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginRight="50dp"
android:layout_marginLeft="50dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/baslaText"
android:layout_marginTop="20dp"
android:textColor="#color/white"
android:textSize="16sp"
android:text="Taşımaya başlamak için kaydolun, ilk \n olarak telefon numaranızı girin"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.cardview.widget.CardView
android:elevation="4dp"
app:cardCornerRadius="14dp"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/telephoneNumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:text="Telefon numaranızı giriniz"
android:textColor="#color/black"
android:textSize="28sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="match_parent"
android:gravity="center"
android:id="#+id/telephoneText"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:textSize="18sp"
app:layout_constraintRight_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/telephoneNumber"
android:text="Taşımaya başlamak için kaydolun, ilk \n olarak telefon numaranızı girin"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/telephoneTag"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="40dp"
android:text="Telefon Numarası"
android:textColor="#color/black"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#id/telephoneText" />
<com.google.android.material.textfield.TextInputLayout
android:elevation="2dp"
app:cardCornerRadius="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/telephoneNumberInput"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/telephoneTag"
android:layout_marginTop="20dp"
app:errorEnabled="true"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
>
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/telephoneNumberEditText"
android:layout_width="match_parent"
android:background="#android:color/transparent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:inputType="number"
android:hint="+.. ... ... .. .."
android:maxLength="12"
android:textColor="#color/black"
android:textSize="14sp"
/>
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="#+id/button"
android:layout_width="match_parent"
android:layout_height="60dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginLeft="30dp"
android:layout_marginBottom="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp"
android:background="#color/purple_500"
android:backgroundTint="#color/purple_500"
android:text="Başlayın"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#id/telephoneNumberInput" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
My themes.xml file.
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.UI" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">#color/teal_200</item>
<item name="colorPrimaryVariant">#color/white</item>
<item name="colorOnPrimary">#color/white</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
write this on your activity onCreate:
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
getWindow().setStatusBarColor(Color.TRANSPARENT);
This code piece did the job I desired.

Scroll view when soft keyboard is up in fragment with Toolbar and windowTranslucentStatus set to true

Fragment is not scrolling when keyboard is up, meanwhile similar setup has work for activities. I added android:windowSoftInputMode="adjustResize|stateAlwaysHidden in the activity that is hosting the fragment, and added android:fitsSystemWindows="true" to the root layout of the fragment. I'm using Butterknife tho. Here are the code:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="#drawable/bg_create_account">
<View
android:id="#+id/vail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/black_two" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_gravity="center"
android:background="#color/black"
android:gravity="center_horizontal"
android:paddingTop="#dimen/status_bar_height">
<TextView
style="#style/ProximaNova18PtWhite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:lineSpacingExtra="4sp"
android:text="#string/create_account"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="16sp" />
</androidx.appcompat.widget.Toolbar>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:id="#+id/inner_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/username_layout"
style="#style/LoginTextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/content_margin"
android:layout_marginEnd="#dimen/content_margin"
android:hint="#string/username"
app:hintAnimationEnabled="true"
app:hintTextAppearance="#style/ProximaNova14Pt"
app:hintTextColor="#color/white">
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/username_edit"
style="#style/LoginEdittextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="noExcludeDescendants"
android:inputType="textEmailAddress"
android:textColorHint="#color/white"
tools:text="dewe" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/email_layout"
style="#style/LoginTextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/content_margin"
android:layout_marginTop="20dp"
android:layout_marginEnd="#dimen/content_margin"
android:hint="#string/email"
app:hintAnimationEnabled="true"
app:hintTextAppearance="#style/ProximaNova14Pt"
app:hintTextColor="#color/white">
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/email_edit"
style="#style/LoginEdittextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="noExcludeDescendants"
android:inputType="textEmailAddress"
android:textColorHint="#color/white"
tools:text="dewe" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/password_layout"
style="#style/LoginTextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/content_margin"
android:layout_marginTop="20dp"
android:layout_marginEnd="#dimen/content_margin"
android:hint="#string/password"
app:hintAnimationEnabled="true"
app:hintTextAppearance="#style/ProximaNova14Pt"
app:hintTextColor="#color/white">
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/password_edit"
style="#style/LoginEdittextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="noExcludeDescendants"
android:inputType="textPassword"
android:textColorHint="#color/white"
tools:text="dewe" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/confirm_password_layout"
style="#style/LoginTextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/content_margin"
android:layout_marginTop="20dp"
android:layout_marginEnd="#dimen/content_margin"
android:hint="#string/confirm_password"
app:hintAnimationEnabled="true"
app:hintTextAppearance="#style/ProximaNova14Pt"
app:hintTextColor="#color/white">
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/confirm_password_edit"
style="#style/LoginEdittextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="noExcludeDescendants"
android:inputType="textPassword"
android:textColorHint="#color/white"
tools:text="dewe" />
</com.google.android.material.textfield.TextInputLayout>
<androidx.appcompat.widget.AppCompatCheckBox
android:id="#+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="#dimen/content_margin"
android:layout_marginTop="40dp"
android:layout_marginEnd="#dimen/content_margin"
android:checked="true"
android:hint="#string/i_agree_to_all_the_terms_and_conditions"
android:padding="0dp"
android:textAppearance="#style/ProximaNova14Pt"
android:textColorHint="#color/white"
app:buttonTint="#color/white" />
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/create_account_button"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="#dimen/content_margin"
android:layout_marginTop="40dp"
android:layout_marginEnd="#dimen/content_margin"
android:background="#drawable/bg_login_button"
android:fontFamily="#font/proxima_nova_regular"
android:lineSpacingExtra="4sp"
android:text="#string/create_account_button"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="18sp" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<FrameLayout
android:id="#+id/terms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/text_view_button_selector"
android:layout_marginBottom="#dimen/default_margin"
android:padding="#dimen/default_margin_half">
<TextView
style="#style/ProximaNova14Pt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/view_terms_and_conditions" />
</FrameLayout>
<View
android:id="#+id/stub"
android:layout_width="match_parent"
android:layout_height="56dp"
android:visibility="gone" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</FrameLayout>
Here's an except from the manifest:
<activity
android:name=".view.EntranceActivity"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.Launcher"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />
And the Activity that host the fragment:
#Layout(R.layout.activity_entrance)
public class EntranceActivity extends BaseActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
router.newRootScreen(new Screens.LoginScreen());
}
#Override
protected void callInjections() {
injection().inject(this);
}
After I removed this line from the activity that host the fragment, it works:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
This was setting the fullscreen mode, and thus prevent adjustResize from working

ConstraintLayout inside ScrollView root not working as expected

I have a ConstraintLayout inside a ScrollView which is the root view of my layout. I wanted the ScrollView to kick in scrolling as soon as the height of the device is less than that is required for the layout.
My layout xml is:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.clickagee.babybind.AccountSettingActivity"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
android:fillViewport="true">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/tv_account_title"
style="#style/textXLargePurple"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/margin_padding_size_medium"
android:layout_marginTop="#dimen/margin_padding_size_medium"
android:text="#string/account"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/btn_add_partner"
style="#style/button"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginEnd="#dimen/margin_padding_size_medium"
android:background="#drawable/custom_button_purple_outline"
android:paddingEnd="#dimen/margin_padding_size_medium"
android:paddingStart="#dimen/margin_padding_size_medium"
android:text="#string/add_partner"
android:textColor="#color/colorAccent"
app:layout_constraintBottom_toBottomOf="#id/tv_account_title"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#id/tv_account_title" />
<LinearLayout
android:id="#+id/ll_upload_change_photo_pane"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_padding_size_large"
android:orientation="vertical"
app:layout_constraintEnd_toStartOf="parent"
app:layout_constraintStart_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#id/btn_add_partner">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/civ_change_upload_photo"
android:layout_width="130dp"
android:layout_height="130dp"
android:src="#drawable/ic_upload_user_image" />
<TextView
android:id="#+id/tv_upload_change_photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/upload_photo" />
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/til_user_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="#dimen/margin_padding_size_medium"
android:layout_marginStart="#dimen/margin_padding_size_medium"
android:layout_marginTop="#dimen/margin_padding_size_medium"
app:layout_constraintTop_toBottomOf="#id/ll_upload_change_photo_pane">
<android.support.design.widget.TextInputEditText
android:id="#+id/et_user_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/name_hint"
android:inputType="textCapWords"
android:lines="1"
android:maxLines="1"
android:singleLine="true"
android:paddingBottom="#dimen/margin_padding_size_medium"/>
</android.support.design.widget.TextInputLayout>
<TextView
android:id="#+id/tv_gender_account_setting"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/margin_padding_size_medium"
android:layout_marginTop="#dimen/margin_padding_size_small"
android:text="#string/gender"
android:textColor="#color/light_grey"
android:textSize="#dimen/text_size_small"
app:layout_constraintTop_toBottomOf="#id/til_user_name" />
<RadioGroup
android:id="#+id/rg_user_gender"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="#dimen/margin_padding_size_medium"
android:layout_marginStart="#dimen/margin_padding_size_medium"
android:layout_marginTop="#dimen/margin_padding_size_small"
android:orientation="horizontal"
android:weightSum="3"
app:layout_constraintTop_toBottomOf="#id/tv_gender_account_setting">
<RadioButton
android:id="#+id/rb_user_male_account_settings"
style="#style/textLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="#dimen/margin_padding_size_medium"
android:layout_weight="1"
android:background="#drawable/rbtn_selector"
android:button="#drawable/custom_radio_button_male"
android:padding="#dimen/margin_padding_size_small"
android:paddingEnd="#dimen/margin_padding_size_medium"
android:text="#string/male"
android:ellipsize="end"
android:maxLines="1"
android:textColor="#color/radio_button_text_colors" />
<RadioButton
android:id="#+id/rb_user_female_account_settings"
style="#style/textLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="#dimen/margin_padding_size_medium"
android:layout_weight="1"
android:background="#drawable/rbtn_selector"
android:button="#drawable/custom_radio_button_female"
android:padding="#dimen/margin_padding_size_small"
android:paddingEnd="#dimen/margin_padding_size_medium"
android:text="#string/female"
android:ellipsize="end"
android:maxLines="1"
android:textColor="#color/radio_button_text_colors" />
<RadioButton
android:id="#+id/rb_user_other_account_settings"
style="#style/textLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/rbtn_selector"
android:button="#drawable/custom_radio_button_other"
android:padding="#dimen/margin_padding_size_small"
android:paddingEnd="#dimen/margin_padding_size_medium"
android:text="#string/other"
android:ellipsize="end"
android:maxLines="1"
android:textColor="#color/radio_button_text_colors" />
</RadioGroup>
<android.support.design.widget.TextInputLayout
android:id="#+id/til_user_phone_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_padding_size_medium"
app:layout_constraintTop_toBottomOf="#id/rg_user_gender">
<android.support.design.widget.TextInputEditText
android:id="#+id/et_user_phone_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="#dimen/margin_padding_size_medium"
android:layout_marginStart="#dimen/margin_padding_size_medium"
android:hint="#string/phone_number_hint"
android:inputType="phone"
android:lines="1"
android:maxLines="1"
android:singleLine="true"
android:paddingBottom="#dimen/margin_padding_size_medium"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/til_user_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="#dimen/margin_padding_size_medium"
android:layout_marginStart="#dimen/margin_padding_size_medium"
android:layout_marginTop="#dimen/margin_padding_size_medium"
app:layout_constraintTop_toBottomOf="#id/til_user_phone_number">
<android.support.design.widget.TextInputEditText
android:id="#+id/et_user_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/email_hint"
android:inputType="textEmailAddress"
android:lines="1"
android:maxLines="1"
android:singleLine="true"
android:paddingBottom="#dimen/margin_padding_size_medium"/>
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:id="#+id/btn_save_details_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="#dimen/margin_padding_size_medium"
android:layout_marginStart="#dimen/margin_padding_size_medium"
android:layout_marginTop="#dimen/margin_padding_size_large"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="#id/til_user_email">
<br.com.simplepass.loading_button_lib.customViews.CircularProgressButton
android:id="#+id/btn_save_details"
style="#style/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/custom_button"
android:padding="#dimen/margin_padding_size_small"
android:text="#string/save_details"
android:textColor="#color/white"
app:spinning_bar_color="#color/white"
app:spinning_bar_padding="#dimen/spinning_bar_padding"
app:spinning_bar_width="#dimen/spinning_bar_width" />
</LinearLayout>
<Button
android:id="#+id/btn_cancel_account_settings"
style="#style/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="#dimen/margin_padding_size_medium"
android:layout_marginStart="#dimen/margin_padding_size_medium"
android:layout_marginTop="16dp"
android:background="#drawable/custom_button_purple_outline"
android:padding="#dimen/margin_padding_size_small"
android:text="#string/cancel"
android:textColor="#color/colorAccent"
app:layout_constraintTop_toBottomOf="#id/btn_save_details_ll"
android:layout_marginBottom="#dimen/margin_padding_size_small"/>
</android.support.constraint.ConstraintLayout>
</ScrollView>
But instead I am getting scroll whether the required height is less or not.
A screenshot of this unusual behavior is
The following should not have happened, Am I missing anything here?:
You're missing a layout_constraintBottom_toBottomOf="parent" to your btn_cancel_account_settings
<Button
android:id="#+id/btn_cancel_account_settings"
style="#style/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="#dimen/margin_padding_size_medium"
android:layout_marginStart="#dimen/margin_padding_size_medium"
android:layout_marginTop="16dp"
android:background="#drawable/custom_button_purple_outline"
android:padding="#dimen/margin_padding_size_small"
android:text="#string/cancel"
android:textColor="#color/colorAccent"
app:layout_constraintTop_toBottomOf="#id/btn_save_details_ll"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="#dimen/margin_padding_size_small"/>
Change
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
Its because your text input field has default focus. Give up the focus from input text field and add the following property: app:layout_constraintBottom_toBottomOf="parent" to btn_cancel_account_settings.

Categories

Resources