java - Android WebView 宽度和高度

标签 java android

我制作了一个 WebView,但由于某种原因,边框没有填满整个屏幕。

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

有什么建议吗?

最佳答案

您的 Webview 上方可能有布局,例如线性、相对等。从该布局中删除所有属性,例如:

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

试试这个:

<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"
tools:context=".MainActivity" >

<WebView
    android:id="@+id/webview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />

希望这有帮助。

关于java - Android WebView 宽度和高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20136614/

相关文章:

java - 如何获取 Java 版本的完整格式名称?

android - 与 GA Android Campaign Tracking 的市场链接

android - 适用于 Android 的单声道

java - Spring 中的请求和 session bean 生命周期

java - 替换时如何保存 fragment 内容?

Java Eclipse : Is it possible to pass arguments between different projects?

android - 如何为桌面上的任何应用程序创建快捷方式?

java - 为什么 Java ThreadPoolExecutor 会覆盖 finalize()

android - 用户混淆/自定义应用程序图标

android - 在 NotificationListenerService 中更新 Realm 时,不会调用 RealmChangeListener