【发布时间】:2014-09-19 21:59:43
【问题描述】:
我正在尝试将 Admob 横幅(在顶部)添加到主要活动(我的主应用程序屏幕),但我遇到了一个小问题,即 admob 广告与文本视图重叠
这是我的主要活动 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:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/adView"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_top_margin"
tools:context="${relativePackage}.${activityClass}" >
<com.google.android.gms.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="ca-app-pub-xxxxxxxxx/xxxxxx"
ads:adSize="BANNER"/>
<LinearLayout
android:id="@+id/linearLayoutHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<!-- First header line -->
<TextView android:id="@+id/header_priority"
android:layout_width="31dp"
android:layout_height="wrap_content"
android:textColor="#00F"
android:gravity="center"
android:textSize="@dimen/font_size_tiny"
android:text="@string/pri_label"
/>
<!-- First header line -->
<TextView android:id="@+id/header_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#00F"
android:textSize="@dimen/font_size_tiny"
android:text="@string/desc_label"
/>
</LinearLayout>
<ListView
android:id="@+id/lvItems"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/llPriority"
android:layout_below="@+id/linearLayoutHeader" >
</ListView>
<LinearLayout
android:id="@+id/llPriority"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<EditText
android:id="@+id/etPriority"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="@string/hint_priority"
android:inputType="number"
android:text="@string/num_1" />
<EditText
android:id="@+id/tvItemText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="3"
android:ems="10"
android:hint="@string/add_hint">
<requestFocus />
</EditText>
<Button
android:id="@+id/btnAdd"
android:layout_width="85dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:onClick="onClickAddItem"
android:text="@string/add_button_label" />
</LinearLayout>
</RelativeLayout>
【问题讨论】:
标签: android android-layout admob