较大设备中的图像尺寸
我的应用程序中有此图像,当我在 Droid X 和 Droid Bionic 以及其他较小的设备中测试它时,它看起来不错。但当我在 Android 平板电脑上测试它时,图像被拉伸了。我只是想知道是否有适当的方法来解决这个问题。
注意:我尝试添加图像的实际大小,例如 200dp x 300dp。但它仍然不起作用
这是我的代码
<RelativeLayout
android:id="@+id/image"
android:layout_alignParentTop="true"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/kittens"/>
</RelativeLayout>
I have this image in my app, when I tested it in my Droid X and Droid bionic and other smaller devices, it looks fine. But when I tested it on my Android Tablet, the image was stretched. I just want to know if there is a proper way to solve this issue.
Note: I have tried adding the actual size of the image like 200dp by 300 dp. But it still don't work
Here is my code
<RelativeLayout
android:id="@+id/image"
android:layout_alignParentTop="true"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/kittens"/>
</RelativeLayout>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要将wrap_content用于ImageView,而是使用dp,例如:
don't use wrap_content for ImageView, instead use dp like: