【发布时间】:2018-10-12 12:20:18
【问题描述】:
我在 Android Studio 中对齐 webview 和 AdView 时遇到问题:
我想要得到的是底部的广告和整个网络视图。但是,我无法调整 webwiev 的大小以从顶部开始。目前,webview 和网站一样大,如下所示: https://www.dropbox.com/s/bkj00jnck049kqm/Unbenannt.png
这是我的 xml 布局代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="0dp"
tools:context=".MainActivity"
tools:ignore="MergeRootFrame">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="bottom">
<WebView
android:id="@+id/activity_main_webview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/ad_view"
/>
<com.google.android.gms.ads.AdView
android:id="@+id/ad_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111"
/>
</LinearLayout>
</RelativeLayout>
【问题讨论】:
标签: android android-studio alignment