0

我在主页底部有横幅广告,如下所示,

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="0dp"
    tools:context=".MainActivity" >

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="10dp"
        android:contentDescription="@string/background"
        android:scaleType="fitXY"
        android:src="@drawable/bg" />

    <RelativeLayout
        android:id="@+id/riverLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/navBar"
        android:background="@drawable/item_bg"
        android:paddingBottom="10dp"
        android:paddingLeft="0dp"
        android:paddingRight="0dp"
        android:paddingTop="0dp" >

        <ImageView
            android:id="@+id/riverImage"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="20dp"
            android:contentDescription="@string/river_image_desc" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_below="@id/riverImage"
            android:layout_marginLeft="5dp"
            android:text="@string/river_text"
            android:textColor="#4494CA"
            android:textSize="17sp"
            android:textStyle="bold" />

        <com.scringo.ScringoCommentButton
            android:id="@+id/riverCommentButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_marginTop="5dp"
            android:layout_below="@id/riverImage"
            android:layout_marginRight="50dp" />

        <com.scringo.ScringoLikeButton
            android:id="@+id/riverLikeButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toLeftOf="@id/riverCommentButton"
            android:layout_below="@id/riverImage"
            android:layout_marginTop="5dp"
            android:layout_marginRight="10dp" />
    </RelativeLayout>

    <Button
        android:id="@+id/riverFeedButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/riverLayout"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="50dp"
        android:text="@string/river_button_text" />

    <Button
        android:id="@+id/openChatRoomButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/riverFeedButton"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="10dp"
        android:text="@string/discover" />

    <Button
        android:id="@+id/openInboxButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/openChatRoomButton"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="10dp"
        android:text="@string/open_inbox_button_text" />

    <com.scringo.ScringoLeftRibbonButton
        android:id="@+id/activationRibbonLeft"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="350dp" />

    <!--
        <com.scringo.ScringoRightRibbonButton
        android:id="@+id/activationRibbonRight"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_marginTop="350dp" />
    -->
    <RelativeLayout
    android:id="@+id/toplayout"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <com.mopub.mobileads.MoPubView
        android:id="@+id/adview"
        android:layout_alignParentBottom="true"
        android:layout_marginTop="10dp"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:background="@drawable/spacer_old"  />
    </RelativeLayout>
</RelativeLayout>

横幅广告视图

'<com.mopub.mobileads.MoPubView   ../>' 

应该在所有页面中显示静态/固定在应用程序每个页面的底部,这意味着我不应该在所有页面中添加这个视图,但它仍然应该显示在所有页面的底部(比如从底部)。这个怎么做

4

2 回答 2

0

android:layout_alignParentBottom属性从com.mopub.mobileads.MoPubView其父级移至RelativeLayout如下

<RelativeLayout
    android:id="@+id/toplayout"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:orientation="vertical" >

    <com.mopub.mobileads.MoPubView
        android:id="@+id/adview"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/spacer_old" />
</RelativeLayout>
于 2014-04-29T06:04:39.597 回答
0

或试试这个

    <com.mopub.mobileads.MoPubView
        android:id="@+id/adview"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/spacer_old" />
</RelativeLayout>
    android:id="@+id/toplayout"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="">

    <com.mopub.mobileads.MoPubView
        android:id="@+id/adview"
        android:layout_alignParentBottom="true"
        android:layout_marginTop="10dp"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:background="@drawable/spacer_old"  />
    </RelativeLayout>
</RelativeLayout>
于 2014-04-29T06:08:06.960 回答