[英]Android WebView width & height
我制作了一個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上方進行布局,例如Linear,Relative..etc。 從該布局中刪除所有屬性,例如:
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" />
希望這可以幫助。
我相信您想給webview加上邊框,它應該填滿整個屏幕。 嘗試這樣的事情。
<LinearLayout
android:id="@+id/ll_webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/blue_line"
>
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:scrollbars="none" />
在您的XML布局中嘗試以下操作:
<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">
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"/>
</RelativeLayout>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.