0
我有以下的东西在我的XML文件奠定了:制作网页视图FILL_PARENT留底图像以上的Android
- 网页视图
- 底部图像/ AdMob广告
因为我希望我的AdMob来显示在底部,我为建议的Admob选择了两种不同的布局LinearLayout,为其他视图选择了RelativeLayout。另外,由于我先显示splashscreen,然后是webview,我的逻辑是这样的,我希望他们都在framelayout中。我的底部形象和Admob一个在另一个之上。 所以,我的代码都为:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/app.news"
android:layout_width="wrap_content"
android:layout_height="fill_parent">
<FrameLayout
android:id="@+id/views"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:id="@+id/splash_screen"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="center"
android:src="@drawable/splash_screen"
android:visibility="visible"
/>
<WebView
android:id="@+id/webvw"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="fill_vertical"
android:scrollbars="none"
android:visibility="invisible"
/>
<ImageView
android:id="@+id/bottomImage"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitEnd"
android:src="@drawable/logo"
android:visibility="visible"
/>
</FrameLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:gravity="bottom"
android:layout_alignBottom="@id/views"
>
<com.admob.android.ads.AdView
android:id="@+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
myapp:backgroundColor="#000000"
myapp:primaryTextColor="#FFFFFF"
myapp:secondaryTextColor="#CCCCCC"
myapp:testing="false"
/>
</LinearLayout>
</RelativeLayout>
我想要的WebView占据所有空间,除了底部的形象,我不知道如何做到这一点的WebView使用高度为“FILL_PARENT”。
任何人都可以请帮忙吗?
Thanx提前。
设置web视图高度0dip正在使网页视图不会出现/可见。 – neha 2010-12-20 10:18:20
但你也需要使用LinearLayout和orientation =“vertical”。首先,孩子是WebView(或包含它的任何嵌套布局),其中layout_height =“0”和layout_weight =“1”。第二个孩子是AdMob,其layout_height =“wrap_content” – Olegas 2011-01-13 08:37:02