简体   繁体   English

如何将AdView放在底部?

[英]How to place AdView at the bottom?

I have some problem in placing AdView at the bottom, if I add this: 如果我添加以下代码,则在将AdView放在底部时会AdView一些问题:

<LinearLayout android:id="@+id/adview_preview_layout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"></LinearLayout> 

AdView code at the bottom, it will either overlap or come to the top of screen. AdView代码位于底部,它将重叠或位于屏幕顶部。

Kindly help me in running this AdView at bottom. 请帮助我在底部运行此AdView Here is the complete code: 这是完整的代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="6dip"
    >

    <TextView
        android:id="@+id/Name"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_marginTop="2dp"
        android:layout_width="fill_parent"
        android:focusable="true" 
        android:focusableInTouchMode="true" 
        android:freezesText="true"
        android:singleLine="true"
        android:gravity="center"
        android:textStyle="bold"
        android:textSize="30dip"
        android:textColor="#FFFFFF"
        android:background="#585858" />

    <ImageView
        android:id="@+id/icon"
        android:layout_width="100dip"
        android:layout_height="100dip"
        android:layout_below="@+id/serviceName"
        android:layout_alignParentLeft="true"
        android:layout_marginRight="6dip"
        android:layout_marginTop="10dip"
        android:scaleType="center"
        android:background="@drawable/list_item_bg"
        android:src="@drawable/ic_launcher"/>


  <TabHost
    android:id="@android:id/tabhost"
    android:layout_below="@+id/icon"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="12dip"
    >

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >

        <TabWidget
            android:id="@android:id/tabs"
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0"/>

          <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_weight="0"/>

        <FrameLayout
            android:id="@+android:id/realtabcontent"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"/>

    </LinearLayout>

</TabHost>

    <LinearLayout android:id="@+id/adview_preview_layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"></LinearLayout>  
</RelativeLayout>

Add this line to your TabHost : 将此行添加到您的TabHost

android:layout_above="@+id/adview_preview_layout"

Like this: 像这样:

<TabHost
    android:id="@android:id/tabhost"
    android:layout_below="@+id/icon"
    android:layout_above="@+id/adview_preview_layout"  /// add this line
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="12dip" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM