android-如何创建像admob这样的页脚横幅

android-如何创建像admob这样的页脚横幅,android,android-activity,Android,Android Activity,我想像admob那样在一些活动中添加自定义横幅和gif动画 我在想,我怎么能像admob一样做一些事情,但却把我自己的横幅 创建一个片段,并将其附加到要显示广告的活动的底部。您必须在片段内放置ImageView/TextView,并执行其他必要的操作,如从服务器下载图像 您可以将线性布局添加到活动的xml布局中,并将其放置在底部 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http:

我想像admob那样在一些活动中添加自定义横幅和gif动画


我在想,我怎么能像admob一样做一些事情,但却把我自己的横幅

创建一个片段,并将其附加到要显示广告的活动的底部。您必须在片段内放置ImageView/TextView,并执行其他必要的操作,如从服务器下载图像

您可以将线性布局添加到活动的xml布局中,并将其放置在底部

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">

    <!-- Add this container layout to the bottom of the screen -->
    <LinearLayout
            android:id="@+id/ad_container"
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_alignParentBottom="true"
            />

</RelativeLayout>
public void initAdView() {
        LinearLayout adViewContainer = findViewById(R.id.ad_container);
        ImageView adView = new ImageView(activity);
        adViewContainer.addView(adView);

        //make other thing to set the gif image to the imageView.
        adView.setImageDrawable(gifImage);
    }