如何制作全屏网页视图 [英] How to make a full screen webview

查看:18
本文介绍了如何制作全屏网页视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使一个android应用程序的webview全屏显示.我已经在布局 xml 文件中添加了 webview,但它不会延伸到布局的边缘,沿着 webview 的所有边都有某种类型的边距.我还添加了一张图片,让大家了解它的实际外观.

How to make the webview of an android application full screen. I have added the webview on a layout xml file but it doesn't stretches out till the edges of the layout, there is some type of margin along all the side of the webview. I am also adding an image to give you guys a hint on what actually it is looking like.

我说的是webview周围的空间,而不是通知栏或标题栏

What i am talking about is the space all around the webview, not the notification bar or the title bar

这是布局代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".WebView" >

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:text="Shake / Tilt Your Phone To Get Accelerometer Motion Alerts" />

<WebView
    android:id="@+id/webview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true" />

</RelativeLayout>

推荐答案

从上面的代码中去掉padding tags -

From above code remove padding tags -

android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"

它将完成这项工作,并确保删除您渲染到 WebView 中的 HTML 的边距/填充,其中可能包含那些留下一些空间的标签.

It will do the job and also be sure to remove the HTML's margins/padding which you are rendering into the WebView that might contain those tags which leaves some space.

这篇关于如何制作全屏网页视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆