我制作了一个 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/