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放在屏幕底部。以上似乎只是它的中心。
我想知道我哪里出错了?
答案 0 :(得分:0)
您将视图定位在底部,但填充整个屏幕,如FD_所述。因此内容以其视图为中心。
答案 1 :(得分: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