How to hide/disable admob adview?

后端 未结 3 1706
暖寄归人
暖寄归人 2021-02-09 16:13

I hide admob adview by view.gone:

//adView.setClickable(false);
//adView.clearFocus();
//adView.setEnabled(false);
//adView.setFilterTouchesWhenObscured(true);
/         


        
3条回答
  •  时光说笑
    2021-02-09 16:59

    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.

提交回复
热议问题