我在我的安卓应用程序中展示了 AdMob 的横幅广告。我希望当用户点击横幅广告时它会消失。我尝试了代码
AdView.setOnClickListener
但是它没有起作用...
编辑:这是代码
private void visual_banner(){
//##### Pubblicità #####
//Create the adView
adView = new AdView(this, AdSize.BANNER, "a14e5bed604ebf8");
// Lookup your LinearLayout assuming it’s been given
// the attribute android:id="@+id/mainLayout"
LinearLayout layout = (LinearLayout)findViewById(R.id.layout_ads_streaming);
// Add the adView to it
layout.addView(adView);
// Initiate a generic request to load it with an ad
adView.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
adView.destroy();
img.setVisibility(View.VISIBLE);
}
});
adView.loadAd(new AdRequest());
//### FINE PUBBLICITA'
}