Android:ImageView 放大源图像
我似乎无法让我的 ImageView 以原始大小显示其源图像。 ImageView 看起来像这样:
<ImageView
android:id="@+id/Logo"
android:src="@drawable/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
</ImageView>
源图像的宽度为 140 像素,但在 Nexus One 的屏幕(480 像素宽)上,它占用了一半的宽度。使用 px 或 dp 绝对值作为宽度和高度不会改变任何内容。图像在放大后看起来也非常抗锯齿。为什么会发生这种情况以及如何预防?
I can't seem to get my ImageView to display its source image in its original size. The ImageView looks like this:
<ImageView
android:id="@+id/Logo"
android:src="@drawable/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
</ImageView>
The source image is 140 pixels wide, yet on the Nexus One's screen, which is 480 pixels wide it uses up half of the width. Using absolute values in px or dp for the width and height changes nothing. The image also looks very antialiased from the upscaling. Why is this happening and how can I prevent it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最有可能的是,Android 正在放大图像,因为您没有告诉它您支持大屏幕。添加合适的
元素 到您的清单,看看是否有帮助。Most likely, Android is scaling up the image, because you did not tell it you were supporting large screens. Add a suitable
<supports-screens>
element to your manifest and see if that helps.