如何隐藏/禁止AdMob的AD浏览报?AdMob、AD

2023-09-09 22:01:04 作者:三分钟放纵

我隐藏的AdMob由AD浏览view.gone:

I hide admob adview by view.gone:

//adView.setClickable(false);
//adView.clearFocus();
//adView.setEnabled(false);
//adView.setFilterTouchesWhenObscured(true);
//adView.setFocusable(false);
//adView.setFocusableInTouchMode(false);
adView.setVisibility(View.GONE);
adView.startAnimation( animation );

这隐藏了广告,但AD浏览报本身仍然是可触摸的,所以如果我触摸AD浏览报的空间,但它仍然会打开浏览器,重定向我的广告,但广告本身是不可见的。

This hides the ad, but the adview itself is still touchable, so if I touch the adview's space, it still opens the browser and redirects me to the ad, although the ad itself is not visible.

如何禁用触摸事件吗?我已经尝试了所有线以上,但没有一次成功。

How to disable the touch event too? I've tried all lines above but none of them worked.

任何意见?

推荐答案

尝试使用setOnTouchListener和覆盖onTouch像你想要的。你也可以使用removeView():

Try to use setOnTouchListener and Override onTouch like you want. Also you can use removeView():

LinearLayout linLay = (LinearLayout)findViewById(R.id.ad_layout);
linLay.removeView(adView); 
LinearLayout.LayoutParams params = new  LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
linLay.addView(adView, params);

和添加它,当你需要的。

and add it back when you need.