Mehmet London
Mehmet London

Reputation: 35

Webview prevent scroll up from specific height

I have one webview. I know how to programmatically scroll down it when page is loaded.
My problem is that I want to prevent the user from scrolling up at the place that I programmatically scrolled down.

Any ideas?

Upvotes: 3

Views: 165

Answers (3)

BooDoo
BooDoo

Reputation: 635

Instead of programmatically scroll down do those changes in xml.

<WebView
        android:layout_marginTop="-10dp"
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

This will crop the content that you want to hide from top

Upvotes: 3

larsaars
larsaars

Reputation: 2350

Use following:

WebView wv = new WebView(this);
wv.setFocusable(false);

and to make it clickable again:

wv.setFocusable(true);

Upvotes: 1

Yogesh Rathi
Yogesh Rathi

Reputation: 6499

Yes, you can prevent Just add setEnabled(false)

Upvotes: 0

Related Questions