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>
 
希望能幫大家解決類似的問題。
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM