ritwik
ritwik

Reputation: 101

Android webview scrolling issue

How can i handle the scrolling in webview such that when cursor comes below certain line, cursor automatically scrolls above it. Is there any function because it can be handled by IOs but i am not finding anything for android.

Upvotes: 1

Views: 1956

Answers (1)

I happy I can help you with this issue!

The solution is really simple! I'm using the same rich editor.

I was facing the same problem and I solve it removing the ScrollView.

What you have to do is on your layout create a Linear layout and inside it put the editor. Just one thing you should include as tag in Linear layout:

android:windowSoftInputMode="adjustPan|adjustResize"

This is my layout (Note: I changed the name of the control)

<LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scrollbars="vertical"
            android:layout_marginLeft="15dp"
            android:layout_marginRight="15dp"
            android:layout_marginTop="15dp"
            android:layout_marginBottom="115dp"
            android:windowSoftInputMode="adjustPan|adjustResize"
            android:background="@drawable/background_container_corner_white"
            android:layout_alignParentTop="true">

            <com.glaucioleonardo.wcmauditor.activities.editor.RichEditor
                android:id="@+id/editor"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_margin="5dp"/>

</LinearLayout>

You don't need to use those tags in Linear layout. I just use them to format according to my app

android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="115dp"
android:background="@drawable/background_container_corner_white"
android:layout_alignParentTop="true"

Now it's working perfectly! If you don't solve your problem, please post your layout and will be easier to help you!

Upvotes: 1

Related Questions