android View的點擊無效的緣由

點擊事件不生效,原來是由於我在裏面的 ImageView中添加了 android:clickable="true"。
解決辦法:刪掉ImageView中的android:clickable="true"。
 
<!--擴大點擊區域-->
<LinearLayout
    android:id="@+id/cancel_ll"
    android:layout_width="45dp"
    android:layout_height="match_parent"
//這裏能解決有時不能點擊的問題。
android:clickable="true"
android:focusable="true"
    android:gravity="center">
 
    <ImageView
        android:layout_width="15dp"
        android:layout_height="15dp"
        android:scaleType="fitXY"
        android:src="@drawable/icon_close_title_pressed" />
</LinearLayout>
 
但願能幫你們解決相似的問題。
相關文章
相關標籤/搜索