1
我在我的android應用程序中使用多個佈局。當我通過setContentView更改佈局時admob橫幅消失。有更改佈局時需要執行的任何操作。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();
}
}
`我真的很感激任何幫助