如何使一个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文件 –