android MoPub广告对齐

时间:2012-07-25 10:07:08

标签: android

你好如何在底部显示mopub广告?

我有这段代码

RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
        params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        mopView = new MoPubView(this);
            mopView.setAdUnitId(PUB_ID_320x50);
            mopView.setLayoutParams(params);
            mopView.loadAd();
            mainRelative.addView(mopView, params);

但它显示在屏幕中央,如何对齐到底部? 附:我的主要布局是RelativeLayout

1 个答案:

答案 0 :(得分:0)

//将您的布局高度更改为生病父母

 RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM,RelativeLayout.TRUE);