如何使一個Webview是-10dp寬度,並與背景圖像父佈局的高度看起來像下面的圖片:如何使webview是-10dp父級佈局的寬度和高度?
更新: 藍盒子是屏幕。 黑色框是外部佈局(@ + id/wrapper),紅色框是webview(@ + id/webview) 綠色框是一些其他佈局。
我試圖用下面的代碼,但沒有成功。 如果webview中的內容太長,則外部佈局會拉伸。我想要一個固定大小的webview內的佈局,但我不知道如何實現這一點。
Ps。黑匣子的背景圖像不是全屏。
會有人給我一些提示嗎?
<?xml version="1.0" encoding="utf-8"?>
<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"
android:background="@drawable/common_background" >
... some other layout ...
<LinearLayout
android:id="@+id/wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/wrapper_background" >
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp" />
</LinearLayout>
... some other layout ...
</RelativeLayout>
剛剛更新的android:layout_height = 「match_parent」 成XML文件 –