如何防止AdView从Android中同一列表项中的其他视图中窃取触摸事件?

时间:2012-02-14 17:00:03

标签: android listview admob

点击带有AdMob AdView的列表项时,即使在广告外点击,所有触摸事件也都会被盗。例如,如果我使用列表项布局,如下所示...

<?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>

如果单击TextView,则不会将所有触摸事件传递给列表项或列表视图事件。

我的问题是,如何防止这种情况?

请注意,所有触摸事件都会成功传递,直到加载广告为止。

0 个答案:

没有答案