我尝试在我的oncreate中添加adView横幅。 但是它会离开屏幕顶部,我使用大多数参数来改变位置到中心按钮,但它不会移动任何原因。
RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
adView = new AdView(this);
adView.setToken("xxxxxxxxxxxxxxxxxxxxxxxx");
addContentView(adView, adParams);
答案 0 :(得分:0)
尝试重力'参数:
FrameLayout.LayoutParams adParams = new
FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT
, LayoutParams.WRAP_CONTENT);
adParams.gravity = Gravity.CENTER;
adView = new AdView(this);
adView.setToken("xxxxxxxxxxxxxxxxxxxxxxxx");
addContentView(adView, adParams);