0

次の設定で、レイアウトに単純な WebView があります

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/rootView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/baserepeat"
    android:gravity="top|center_horizontal"
    android:orientation="vertical"
    android:paddingBottom="20dp"
    android:paddingLeft="20dp"
    android:paddingRight="20dp" >
 <WebView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/productDetailContentWebview"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="top"
        android:background="@drawable/baserepeat" />
//other items...

私のマニフェスト内には、含むアクティビティがに設定されています

    <activity
        android:name=".Products.ProductDetailActivity"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:screenOrientation="sensor"
        android:theme="@style/Theme.CPS" >
    </activity>

私の Webview には、デバイス上の単純な HTML ファイルが取り込まれており、うまく機能しています。問題は、デバイスを縦向きから横向きに回転させると、Web ビューの高さがかなり高くなり、その下にあるものがレイアウト内でさらに下に押し出されることです。コンテンツの量は変わりません。すべて OnCreate() で設定されます。

私は Webview を使用して、独自の特別なスタイルシートでコンテンツをレンダリングしていますが、ScrollView 内にとどまる必要があります。

必要に応じて、より多くの情報を提供できます:)

4

2 に答える 2

4

2.3/4.0で作業しているときに同様の問題がありました...

私はいくつかのことを試しましたが、コアの問題を取り除くのに役立った解決策は次のとおりです。

screenSizeから削除android:configChanges_AndroidManifest.xml

それが役に立てば幸い !!!

于 2012-06-07T04:26:37.187 に答える
0

Try including your webview inside a FrameLayout.

<LinearLayout>
   <FrameLayout>  
   <WebView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/productDetailContentWebview"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="top"
    android:background="@drawable/baserepeat" />
   </FrameLayout>
于 2012-06-06T07:57:23.750 に答える