AdMob v4.4 BOTTOM LEFT引力不起作用

时间:2014-05-10 02:16:08

标签: java android admob google-play-services

注意:我们使用的是版本为4.4的新GooglePlayServices AdMob

当“onCreate”被调用时,我创建内容视图,如下所示:

ContentView = new FrameLayout(this);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
addContentView(ContentView, params);

当我设置AdView引力时,我会这样做:

FrameLayout.LayoutParams viewParams = new FrameLayout.LayoutParams(320, 50, Gravity.BOTTOM | Gravity.LEFT);
adView.setLayoutParams(viewParams);

任何想法都错了吗?

1 个答案:

答案 0 :(得分:3)

设置adview的参数如下:

  RelativeLayout.LayoutParams viewParams = 
                    new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, 
                            RelativeLayout.LayoutParams.WRAP_CONTENT);
                viewParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
                viewParams.addRule(RelativeLayout.ALIGN_LEFT);

adView.setLayoutParams(viewParams);