Android WebView - scrollbar don't fill the layout_height
I have a WebView with large text content.
I'm using the following WebView settings:
settings.setJavaScriptEnabled(true);
settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true);
settings.setSupportZoom(false);
settings.setBuiltInZoomControls(false);
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webview.setScrollbarFadingEnabled(false);
The Html viewport settings are:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
The problem is that the scrollbar is going outside the layout, as follow:
My Android Layout is:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<LinearLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>
android webview android-webview android-browser android-websettings
add a comment |
I have a WebView with large text content.
I'm using the following WebView settings:
settings.setJavaScriptEnabled(true);
settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true);
settings.setSupportZoom(false);
settings.setBuiltInZoomControls(false);
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webview.setScrollbarFadingEnabled(false);
The Html viewport settings are:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
The problem is that the scrollbar is going outside the layout, as follow:
My Android Layout is:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<LinearLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>
android webview android-webview android-browser android-websettings
Are you able to scroll the last line of text or its hiding behind bottom menu buttons ?
– Anand Phadke
Nov 22 '18 at 12:57
I can go to the last line of Html content (text) but when I'm there the scrollbar is gone.
– Apopei Andrei Ionut
Nov 22 '18 at 13:21
I think removing content=user-scalable=no or setting it to yes from your html viewport settings should do the trick.
– dglozano
Nov 28 '18 at 0:19
the bounty is about to end give it to the closest answer or it all goes to waste
– Pemba Tamang
Dec 4 '18 at 10:22
add a comment |
I have a WebView with large text content.
I'm using the following WebView settings:
settings.setJavaScriptEnabled(true);
settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true);
settings.setSupportZoom(false);
settings.setBuiltInZoomControls(false);
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webview.setScrollbarFadingEnabled(false);
The Html viewport settings are:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
The problem is that the scrollbar is going outside the layout, as follow:
My Android Layout is:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<LinearLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>
android webview android-webview android-browser android-websettings
I have a WebView with large text content.
I'm using the following WebView settings:
settings.setJavaScriptEnabled(true);
settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true);
settings.setSupportZoom(false);
settings.setBuiltInZoomControls(false);
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webview.setScrollbarFadingEnabled(false);
The Html viewport settings are:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
The problem is that the scrollbar is going outside the layout, as follow:
My Android Layout is:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<LinearLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>
android webview android-webview android-browser android-websettings
android webview android-webview android-browser android-websettings
edited Nov 22 '18 at 13:20
Ali
1
1
asked Nov 22 '18 at 12:53
Apopei Andrei IonutApopei Andrei Ionut
154421
154421
Are you able to scroll the last line of text or its hiding behind bottom menu buttons ?
– Anand Phadke
Nov 22 '18 at 12:57
I can go to the last line of Html content (text) but when I'm there the scrollbar is gone.
– Apopei Andrei Ionut
Nov 22 '18 at 13:21
I think removing content=user-scalable=no or setting it to yes from your html viewport settings should do the trick.
– dglozano
Nov 28 '18 at 0:19
the bounty is about to end give it to the closest answer or it all goes to waste
– Pemba Tamang
Dec 4 '18 at 10:22
add a comment |
Are you able to scroll the last line of text or its hiding behind bottom menu buttons ?
– Anand Phadke
Nov 22 '18 at 12:57
I can go to the last line of Html content (text) but when I'm there the scrollbar is gone.
– Apopei Andrei Ionut
Nov 22 '18 at 13:21
I think removing content=user-scalable=no or setting it to yes from your html viewport settings should do the trick.
– dglozano
Nov 28 '18 at 0:19
the bounty is about to end give it to the closest answer or it all goes to waste
– Pemba Tamang
Dec 4 '18 at 10:22
Are you able to scroll the last line of text or its hiding behind bottom menu buttons ?
– Anand Phadke
Nov 22 '18 at 12:57
Are you able to scroll the last line of text or its hiding behind bottom menu buttons ?
– Anand Phadke
Nov 22 '18 at 12:57
I can go to the last line of Html content (text) but when I'm there the scrollbar is gone.
– Apopei Andrei Ionut
Nov 22 '18 at 13:21
I can go to the last line of Html content (text) but when I'm there the scrollbar is gone.
– Apopei Andrei Ionut
Nov 22 '18 at 13:21
I think removing content=user-scalable=no or setting it to yes from your html viewport settings should do the trick.
– dglozano
Nov 28 '18 at 0:19
I think removing content=user-scalable=no or setting it to yes from your html viewport settings should do the trick.
– dglozano
Nov 28 '18 at 0:19
the bounty is about to end give it to the closest answer or it all goes to waste
– Pemba Tamang
Dec 4 '18 at 10:22
the bounty is about to end give it to the closest answer or it all goes to waste
– Pemba Tamang
Dec 4 '18 at 10:22
add a comment |
3 Answers
3
active
oldest
votes
I fixed the issue by adding the following on the WebView layout:
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
can u explain how doeslayout_alignParentTop
,layout_alignParentLeft
,layout_alignParentStart
will work insideLinearLayout
– Nilesh Rathod
Nov 29 '18 at 4:26
yeah odd........
– Pemba Tamang
Dec 4 '18 at 10:22
add a comment |
try this :-
<WebView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/webView" />
i fix this issue with this code
fill_parent
is deprecated
– Nilesh Rathod
Nov 29 '18 at 4:24
add a comment |
You can add padding to parent layout
<WebView android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webView"
android:padding="3dp"/>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431492%2fandroid-webview-scrollbar-dont-fill-the-layout-height%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I fixed the issue by adding the following on the WebView layout:
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
can u explain how doeslayout_alignParentTop
,layout_alignParentLeft
,layout_alignParentStart
will work insideLinearLayout
– Nilesh Rathod
Nov 29 '18 at 4:26
yeah odd........
– Pemba Tamang
Dec 4 '18 at 10:22
add a comment |
I fixed the issue by adding the following on the WebView layout:
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
can u explain how doeslayout_alignParentTop
,layout_alignParentLeft
,layout_alignParentStart
will work insideLinearLayout
– Nilesh Rathod
Nov 29 '18 at 4:26
yeah odd........
– Pemba Tamang
Dec 4 '18 at 10:22
add a comment |
I fixed the issue by adding the following on the WebView layout:
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
I fixed the issue by adding the following on the WebView layout:
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
answered Nov 28 '18 at 8:40
Apopei Andrei IonutApopei Andrei Ionut
154421
154421
can u explain how doeslayout_alignParentTop
,layout_alignParentLeft
,layout_alignParentStart
will work insideLinearLayout
– Nilesh Rathod
Nov 29 '18 at 4:26
yeah odd........
– Pemba Tamang
Dec 4 '18 at 10:22
add a comment |
can u explain how doeslayout_alignParentTop
,layout_alignParentLeft
,layout_alignParentStart
will work insideLinearLayout
– Nilesh Rathod
Nov 29 '18 at 4:26
yeah odd........
– Pemba Tamang
Dec 4 '18 at 10:22
can u explain how does
layout_alignParentTop
, layout_alignParentLeft
, layout_alignParentStart
will work inside LinearLayout
– Nilesh Rathod
Nov 29 '18 at 4:26
can u explain how does
layout_alignParentTop
, layout_alignParentLeft
, layout_alignParentStart
will work inside LinearLayout
– Nilesh Rathod
Nov 29 '18 at 4:26
yeah odd........
– Pemba Tamang
Dec 4 '18 at 10:22
yeah odd........
– Pemba Tamang
Dec 4 '18 at 10:22
add a comment |
try this :-
<WebView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/webView" />
i fix this issue with this code
fill_parent
is deprecated
– Nilesh Rathod
Nov 29 '18 at 4:24
add a comment |
try this :-
<WebView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/webView" />
i fix this issue with this code
fill_parent
is deprecated
– Nilesh Rathod
Nov 29 '18 at 4:24
add a comment |
try this :-
<WebView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/webView" />
i fix this issue with this code
try this :-
<WebView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/webView" />
i fix this issue with this code
answered Nov 28 '18 at 15:32
Harpreet SinghHarpreet Singh
112
112
fill_parent
is deprecated
– Nilesh Rathod
Nov 29 '18 at 4:24
add a comment |
fill_parent
is deprecated
– Nilesh Rathod
Nov 29 '18 at 4:24
fill_parent
is deprecated– Nilesh Rathod
Nov 29 '18 at 4:24
fill_parent
is deprecated– Nilesh Rathod
Nov 29 '18 at 4:24
add a comment |
You can add padding to parent layout
<WebView android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webView"
android:padding="3dp"/>
add a comment |
You can add padding to parent layout
<WebView android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webView"
android:padding="3dp"/>
add a comment |
You can add padding to parent layout
<WebView android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webView"
android:padding="3dp"/>
You can add padding to parent layout
<WebView android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webView"
android:padding="3dp"/>
answered Nov 29 '18 at 9:07
Uma AchantaUma Achanta
2,13221135
2,13221135
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431492%2fandroid-webview-scrollbar-dont-fill-the-layout-height%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you able to scroll the last line of text or its hiding behind bottom menu buttons ?
– Anand Phadke
Nov 22 '18 at 12:57
I can go to the last line of Html content (text) but when I'm there the scrollbar is gone.
– Apopei Andrei Ionut
Nov 22 '18 at 13:21
I think removing content=user-scalable=no or setting it to yes from your html viewport settings should do the trick.
– dglozano
Nov 28 '18 at 0:19
the bounty is about to end give it to the closest answer or it all goes to waste
– Pemba Tamang
Dec 4 '18 at 10:22