0

画面の一部に Web ビューを表示する必要があるレイアウトがあります。レイアウトを設定し、Eclipse のグラフィカル レイアウトでは、次のように、希望どおりに表示されます (ロゴと見出しは黒く塗りつぶされています)。

グラフィカル レイアウトに示すレイアウト

ただし、シミュレーターまたは電話でこのレイアウトを開くと、WebView が全画面表示されます。このようなレイアウトを作成するにはどうすればよいですか? どんな助けでも大歓迎です!

ここに私のXMLがあります:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/Theme.KB_default"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/header_background_shape" >
        <TextView
            android:id="@+id/heading"
            style="@style/Theme.KB_header"
            android:layout_width="wrap_content"
            android:layout_centerHorizontal="true"
            android:text="@string/app_name" >
        </TextView>
        <ImageView
            android:id="@+id/imageViewPadlock"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="10dp"
            android:contentDescription="@string/global_secure_connection"
            android:src="@drawable/padlock" />
    </RelativeLayout>
    <View
        android:layout_width="fill_parent"
        android:layout_height="1dip"
        android:background="@color/black" >
    </View>
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="0.41"
        android:orientation="vertical" >
        <WebView
        android:id="@+id/webview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />
    </LinearLayout>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical" >
        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="40dp"
            android:layout_height="20dp"
            android:layout_marginBottom="5dp"
            android:layout_marginLeft="15dp"
            android:contentDescription="@string/global_logo"
            android:scaleType="fitXY"
            android:src="@drawable/logo_transparrent_notext" />
    </LinearLayout>
</LinearLayout>
4

2 に答える 2

0

さて、私は生きている愚かな人のようです。レイアウトは機能しましたが、「setContentView(xml.file);」を追加するのを忘れました。そのため、XMLをロードすることはありません...愚かな

于 2012-08-23T12:38:16.153 に答える
0

テーブル ブロックの 1 つを webview として作成する

このリンクを確認してください

http://developer.android.com/reference/android/widget/TableLayout.html

ダイアログを使用してこの例を確認することもできます

http://www.41post.com/4673/programming/android-creating-a-webview-dialog

于 2012-08-23T10:41:26.310 に答える