How to hide/disable admob adview?(如何隐藏/禁用 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何隐藏/禁用 admob adview?


- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- android 4中的android RadioButton问题 2022-01-01