Why does my WebView not fill the entire width of the screen?

My WebView does not fill the entire width of my phone. I say fill_parent. Do not know why?

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="horizontal">

    <WebView android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/WebView"></WebView>
    </LinearLayout>
+5
source share
5 answers

The linear layout is oriented horizontally. I do not think you can fill the width of the horizontal orientation.

Try using RelativeLayout instead. (just rename LinearLayout to RelativeLayout)

+2
source

This size is handled by the webview scrollbar. use this to get rid of it.

browser.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
+15
source

(xml) , , LinearLayout , :   : paddingBottom = "@DIMEN/activity_vertical_margin"   : paddingLeft = "@DIMEN/activity_horizontal_margin"   : paddingRight = "@DIMEN/activity_horizontal_margin"   : paddingTop = "@DIMEN/activity_vertical_margin"

, WebView fill_parent, .

+5

, xml ... .

, wrap_content LinearLayout

   <LinearLayout android:orientation="horizontal"  android:background="@drawable/dailygoal"
        android:layout_height="wrap_content" android:layout_width="fill_parent"
       android:padding="3px"

      >         
            <WebView
        android:id="@+id/dailygoalswebview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
         android:layout_gravity="right"
         android:padding="20px" 
        >
    </WebView>
             </LinearLayout>

xml main.xml... , .

0

(xml) , , , : android: paddingBottom = "@dimen/activity_vertical_margin" android: paddingLeft = "@dimen/activity_horizontal_margin" android: paddingRight = "@dimen/activity_horizontal_margin" android: paddingTop = "@dimen/activity_vertical_margin"

, "fill_parent".

0

All Articles