如何防止ImageButton拉伸图片?
使用以下代码片段:
我得到以下效果:
使用以下代码片段:
<ImageButton
android:src="@drawable/prediction"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_horizontal"
android:scaleType="centerInside"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:contentDescription="some description"
android:text="@string/predict"
local:MvxBind="Click ExecuteQueryCmd" />
我得到以下效果:
图像为64x64的png格式。
我想要的是ImageButton能够尊重所分配的图像的本地宽度和长度,因此分辨率。基于类似的帖子的建议是使用Button,将其背景设置为图像,然后使用自定义选择器,但这听起来像是一种hack方法。或者这是正确的方法吗?