AdMob AdView 出现在 Android 中的 ListView 之上
我试图让 AdView 出现在布局的底部,它有点工作,但由于某种原因,我的 AdView 覆盖了 ListView 的最后几行,而不是出现在它之后。我尝试了很多方法,包括将 ListView 设置为高度 0px。和重量1,都没有运气。有什么线索吗?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/home_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/banner"
android:background="#000000"
android:layout_height="45dip"
android:orientation="horizontal"
>
<TextView android:text="MAIN"
android:id="@+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dip"
android:paddingLeft="5dip"
android:layout_weight="1">
</TextView>
<TextView android:text="HEADER"
android:id="@+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dip"
android:layout_weight="1">
</TextView>
</LinearLayout>
<View android:id="@+id/divider"
android:background="@drawable/bw_gradient"
android:layout_width="fill_parent"
android:layout_height="3dip"
/>
<ListView
android:id="@android:id/list"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
>
</ListView>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/ad_layout"
android:gravity="bottom"
android:layout_alignParentBottom="true"
android:layout_alignBottom="@+id/home_layout"
>
<com.google.ads.AdView
android:id="@+id/adView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="5555555555"
ads:adSize="BANNER"
ads:loadAdOnCreate="false"
/>
</LinearLayout>
I am trying to get an AdView to appear at the bottom of my layout, its sort of working but for some reason my AdView is covering the last few rows of my ListView, instead of apearing right after it. I have tried a bunch of things including setting the ListView with height 0px. and weight 1, all with no luck. Any clues?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/home_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/banner"
android:background="#000000"
android:layout_height="45dip"
android:orientation="horizontal"
>
<TextView android:text="MAIN"
android:id="@+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dip"
android:paddingLeft="5dip"
android:layout_weight="1">
</TextView>
<TextView android:text="HEADER"
android:id="@+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dip"
android:layout_weight="1">
</TextView>
</LinearLayout>
<View android:id="@+id/divider"
android:background="@drawable/bw_gradient"
android:layout_width="fill_parent"
android:layout_height="3dip"
/>
<ListView
android:id="@android:id/list"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
>
</ListView>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/ad_layout"
android:gravity="bottom"
android:layout_alignParentBottom="true"
android:layout_alignBottom="@+id/home_layout"
>
<com.google.ads.AdView
android:id="@+id/adView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="5555555555"
ads:adSize="BANNER"
ads:loadAdOnCreate="false"
/>
</LinearLayout>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)