This should be pretty basic, I just can\'t find out how. I have a webView that shows a page to is too long to show all at once. Right now, it shows the scroll bar, but it
did you think about using ScrollView ??
<ScrollView android:layout_width="fill_parent"
android:layout_height="86px"
android:id="@+id/scrollTxtDescription"
android:layout_below="@id/txtLieuPromo1"
android:layout_alignLeft="@id/txtLieuPromo1">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/layoutTxtDescription"
>
<WebView android:id="@+id/txtDescription"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</ScrollView>
i use the next code and it worked for me (tested on android 2.3 and android 4.2 )
layout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<WebView
android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
</ScrollView>
code:
final WebSettings settings = mWebView.getSettings();
settings.setDomStorageEnabled(true);
settings.setJavaScriptEnabled(true);
mWebView.setVerticalScrollBarEnabled(true);
mWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(final WebView view, final String url) {
super.shouldOverrideUrlLoading(view, url);
return false;
}
@Override
public void onPageFinished(final WebView view, final String url) {
super.onPageFinished(view, url);
mWebView.requestLayout();
}
});
mWebView.loadUrl(uri);