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