How to prevent AdView from stealing touch events from another view in the same list item in Android?

When you click on a list item using AdMob AdView, all touch events are stolen, even if they go beyond the limits of the ad. For example, if I use a list item layout, for example the following ...

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <TextView android:id="@android:id/text1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="hello world!"/> <com.google.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="50dp" ads:adSize="BANNER" ads:adUnitId="MY_AD_UNIT" ads:loadAdOnCreate="true" ads:testDevices="TEST_EMULATOR" /> </LinearLayout> 

All touch events will not be passed to the list item or list event if I click on TextView.

My question is: how can I prevent this?

Please note that all touch events are successfully transmitted before the ad is loaded.

+4
source share

Source: https://habr.com/ru/post/1396438/


All Articles