問題:
- 在開發項目時候,會有的場景(自定義的返回鍵,點贊,刪除等)使用時,圖標太小,點擊事件的有效區域就太小!
- 那麼如何擴大點擊事件的有效區域呢?
解決:
- 一行代碼就能讓自己的按鈕像ActionBar的返回鍵一樣,具有強大的有效點擊區域!
代碼:android:scaleType=“centerInside”(高度,寬度設置成自己的需求,這個屬性只適合ImageView控件)
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:scaleType="centerInside"
android:src="@mipmap/ic_launcher"/>