5

私のWebViewは私の電話の幅全体を埋めていません。私はfill_parentに言っています。理由がわかりませんか?

<?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>
4

5 に答える 5

15

そのサイズは、webview のスクロール バーによって占められています。これを使って解消しよう

browser.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
于 2011-04-11T14:57:02.063 に答える
5

アクティビティ レイアウト (xml) では、より具体的には LinearLayout タグには、デフォルトで次のようなパディングが含まれています。 paddingTop="@dimen/activity_vertical_margin"

それを削除し、WebView を fill_parent に設定すると、ジョブが実行されます。

于 2013-09-16T08:21:53.063 に答える
2

線形レイアウトは水平方向です。水平方向の幅を埋めることはできないと思います。

代わりに RelativeLayout を使用してみてください。(LinearLayout の名前を RelativeLayout に変更するだけです)

于 2010-10-04T22:35:14.647 に答える
0

私のxmlでは、問題なく幅を埋めることができることを知っています...チェックしてください。

私のベースLinearLayoutでwrap_contentを使用していることがわかります

   <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 レイアウトに適用したところです...幸運を祈ります..

于 2011-04-04T08:04:32.407 に答える