繁体   English   中英

在Android上显示广告

[英]Show an advertisement on Android

我必须使用leadboltcontroller jar在屏幕底部显示广告。我已经实现了代码,并且还提供了所有权限集。 但是我没有得到任何广告。 这是我的代码:

public class Leadbolt_DemoActivity extends Activity {
    /** Called when the activity is first created. */

    private AdController mucontroller;
    private String MY_LB_SECTION_ID="328886602";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
      RelativeLayout rlbottom=(RelativeLayout)findViewById(R.id.relbottom);
      final Activity act = this;  
      rlbottom.post(new Runnable() {

          public void run() { 
              mucontroller = new AdController(act, MY_LB_SECTION_ID); 
              mucontroller.setAsynchTask(true);

              mucontroller.loadNotification();
              mucontroller.setAdditionalDockingMargin(50);
              mucontroller.loadAd(); 
          } 
          //});
      });

我已经在另一台机器上给了另一个应用程序的一个addid,但是我仍然没有得到任何addid。.每个应用程序和每台机器的addid是唯一的吗?请帮助我。

使用Relativelayout来放置广告的页脚

 <?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="fill_parent">
<bla.bla.AdView
        android:id="@+id/ad"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="#FF0000"/>
<ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@id/ad"/>

是您正在寻找的职位。

暂无
暂无

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

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