【问题标题】:How to place your ads at the bottom of your screen in Android如何在 Android 中将广告放置在屏幕底部
【发布时间】:2017-10-19 18:31:29
【问题描述】:

我想在屏幕底部放置广告横幅 startapp。它一直出现在顶部。我希望它位于屏幕的底部,您可以在此处找到我的代码 ..
我正在尝试将广告定位在屏幕底部,但似乎没有任何效果。

下面是布局的 XML 代码,非常感谢。

    <android.support.constraint.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="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:background="@mipmap/pictureone"
        tools:context="org.sna.myapplication.MainActivity">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center"
        android:background="@mipmap/pictureone"
        android:weightSum="10"
        android:clickable="false">

        <TextView
            android:layout_width="340dp"
            android:layout_height="wrap_content"
            android:text="click NEXT  to start the application"
            android:id="@+id/textView3"
            android:layout_gravity="center_horizontal"
            android:textColor="#ffffff"
            android:textSize="30dp"
            android:layout_weight="1.58"
            android:textAlignment="center" />

        <ImageView
            android:layout_width="150dp"
            android:layout_height="wrap_content"
            android:id="@+id/imageView6"
            android:layout_gravity="center_horizontal"
            android:layout_weight="1"
            android:background="@mipmap/oussama"
            android:layout_marginTop="1dp"
            android:clickable="true"
            android:onClick="next" />

    </LinearLayout>

<com.startapp.android.publish.ads.banner.Banner
    android:id="@+id/startAppBanner"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    tools:layout_editor_absoluteY="0dp"
    tools:layout_editor_absoluteX="0dp" />   
</android.support.constraint.ConstraintLayout>   

【问题讨论】:

    标签: mobile admob banner startapp


    【解决方案1】:

    在您的 LinearLayout 中放置横幅

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center"
        android:background="@mipmap/pictureone"
        android:weightSum="10"
        android:clickable="false">
    
        <TextView
            android:layout_width="340dp"
            android:layout_height="wrap_content"
            android:text="click NEXT  to start the application"
            android:id="@+id/textView3"
            android:layout_gravity="center_horizontal"
            android:textColor="#ffffff"
            android:textSize="30dp"
            android:layout_weight="1.58"
            android:textAlignment="center" />
    
        <ImageView
            android:layout_width="150dp"
            android:layout_height="wrap_content"
            android:id="@+id/imageView6"
            android:layout_gravity="center_horizontal"
            android:layout_weight="1"
            android:background="@mipmap/oussama"
            android:layout_marginTop="1dp"
            android:clickable="true"
            android:onClick="next" />
    
        <com.startapp.android.publish.ads.banner.Banner
            android:id="@+id/startAppBanner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            tools:layout_editor_absoluteY="0dp"
            tools:layout_editor_absoluteX="0dp" />
    
    </LinearLayout>
    

    【讨论】:

    • 我不太了解你,你能告诉我在哪里可以添加这个
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-27
    • 2013-10-13
    • 2016-01-27
    • 1970-01-01
    相关资源
    最近更新 更多