本文介绍了如何隐藏/禁用 admob adview?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我通过 view.gone 隐藏 admob adview:
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 );
这隐藏了广告,但广告视图本身仍然是可触摸的,所以如果我触摸广告视图的空间,它仍然会打开浏览器并将我重定向到广告,尽管广告本身不可见.
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 和 Override 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.
这篇关于如何隐藏/禁用 admob adview?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!