我在我的 android 应用程序中使用多个布局。当我通过 setContentView 更改布局时,admob 横幅消失了。在更改布局时我需要做些什么。
public void setContentView (int layoutResID)
{
super.setContentView(layoutResID);
// Create the adView
try {
// Lookup your LinearLayout assuming it's been given
// the attribute android:id="@+id/mainLayout"
RelativeLayout layout = (RelativeLayout)
findViewById(getRespectiveLayoutID(layoutResID));
//adView.setGravity(Gravity.BOTTOM);
// Add the adView to it
layout.addView(adView);
// Initiate a generic request to load it with an ad
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
`我真的很感激任何帮助