0

hi every one i have a problem in android studio

when i change a value or move a component , scrollview scrolling to top of the layout and i don't know why!!

here is screenshot

screenshot

and here is xml:

        <androidx.core.widget.NestedScrollView
            android:id="@+id/scrollView2"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintBottom_toTopOf="@+id/btn_info_workpage"
            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="match_parent">

            ...

            </androidx.constraintlayout.widget.ConstraintLayout>
        </androidx.core.widget.NestedScrollView>

amir
  • 21
  • 4

1 Answers1

0

It's probably that the modified view is getting focused, and you can stop that by setting the "android:focusable" to false on the view with a value change while setting the same property to true on the parent view.

More Info and sample code in this question and it's answers: How to stop EditText from gaining focus at Activity startup in Android

francis duvivier
  • 2,056
  • 11
  • 17