1
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);

lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

layout.addView(this.adView,lp);

我正在尝试将我的 adView 放在屏幕底部。以上似乎只是将其居中。

我想知道我哪里错了?

4

2 回答 2

0

尝试改变:

RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);

至:

RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);

请注意,我还将 LinearLayout 更改为 RelativeLayout

于 2013-07-30T14:42:07.617 回答
0

您将视图定位在底部,但像 FD_ 提到的那样填充整个屏幕。所以内容以它的视图为中心。

于 2013-07-30T14:34:08.020 回答