gpt4 book ai didi

java - AdMob v4.4 左下重力不起作用

转载 作者:行者123 更新时间:2023-12-01 22:59:10 25 4
gpt4 key购买 nike

注意:我正在使用 4.4 版的新 GooglePlayServices AdMob

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

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);

有什么问题吗?

最佳答案

按如下方式设置广告 View 的参数:

  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);

关于java - AdMob v4.4 左下重力不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23576427/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com