【发布时间】:2014-01-13 16:54:10
【问题描述】:
我想将图像用作 Android 应用程序的按钮,因此我使用的是 ImageButton。 我希望它很大,所以我明白最好的方法是将图像的背景配置为我想要的图像。 我将布局宽度和高度设置为 250dip,但分辨率很低。 图像是 1000X1000 像素,所以没有真正的理由会显示像素化,因为它正在显示...... 有没有办法解决这个问题?要将图像按钮设置得非常大并使用质量更好的图像(例如来自 drawable-xhdpi)? 谢谢!
编辑:
这是 imageView 的代码:
<ImageView
android:id="@+id/activateButtonImage"
android:layout_width="250dip"
android:layout_height="250dip"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:contentDescription="@null"
android:minHeight="250dip"
android:minWidth="250dip"
android:scaleType="centerInside"
android:background="@drawable/deactivateicon"
/>
截图:
【问题讨论】:
-
两个答案都正确,我的问题是将图片导入项目 usibg eclipse。它奇怪地缩放它们并使用低分辨率属性。解决方案只是将 insge 复制到项目文件夹中。谢谢!
标签: android image button imagebutton dpi