0

I have some views inside a nested scroll view one of the view is a resusable layout which contains an edit text, when I click on the edit text the view scrolls a bit up but not enough to show the edit text, the only way to see the edit text is to manually scroll down to get the edit text

<androidx.coordinatorlayout.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >

<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white"
        android:orientation="vertical">

// Some views here

<androidx.core.widget.NestedScrollView
            android:id="@+id/scrollView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/appBar"
            android:layout_marginBottom="40dp"
            android:paddingBottom="@dimen/SIZE_50"
            android:background="@color/colorWhite"
            android:fillViewport="true">

<LinearLayout
                android:id="@+id/post_details"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:weightSum="1">

//Some more views

<include
                        android:id="@+id/bottom_layout"
                        layout="@layout/comment_layout"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" />

// more layouts

</LinearLayout>

        </androidx.core.widget.NestedScrollView>

    </RelativeLayout>

<FrameLayout
            android:id="@+id/bottom_sheet"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            app:behavior_hideable="true"
            app:layout_behavior="bottomSheetBehaviour">

            <Button/>

        </FrameLayout>

        <View
            android:layout_width="1dp"
            android:layout_height="4dp"
            app:layout_anchor="@id/layout"
            app:layout_anchorGravity="bottom" />
    </androidx.coordinatorlayout.widget.CoordinatorLayout>

The current behaviour is that when keyboard pops up the button in the framelayout is shown above the keyboard but edit text is not, when I scroll the nested scroll view manually the edit text along with the button is visible above the keyboard which is the desired solution but how to make this happen automatically as soon as the keyboard pops up?

EDIT: I figured out to listen for keyboard using global listener the thing I can't figure out is how to scroll to the position of the bottom_layout where the edit text is there

Aziz Agasi
  • 53
  • 7
  • are you using adjust pan in the Android Manifest for the activity – Narendra_Nath Dec 01 '21 at 07:30
  • @Narendra_Nath Yes I am – Aziz Agasi Dec 01 '21 at 07:55
  • Make sure to structure it such that there is ample place both above the section and below it. Can you attach a photo of your layout – Narendra_Nath Dec 01 '21 at 08:48
  • Unfortunately I cannot but rest assured there is enough space between those views the only way to solve it is to scroll the nested scroll view at the position of the view where we have the edit text, but that is not working, I tried wrapping the included layout into linear layout but that didn't work too – Aziz Agasi Dec 01 '21 at 08:58

0 Answers0