简体   繁体   English

在横向大型设备上查看时,Android Imageview变形

[英]Android Imageview distorted when viewing on landscape large devices

I am currently trying to show an image using imageview, this image just has the certain height but it should fill the entire width of the screen. 我目前正在尝试使用imageview显示图像,该图像仅具有一定的高度,但它应填充屏幕的整个宽度。 On portrait mode it and landscape mode on a mobile phone(Samsung galaxy note 2) it shows just fine but when I tried it on a tablet(Samsung galaxy tab), the portrait mode still looks great But in landscape mode what happens is that the image looks distorted, the image covers the entire width but the height seems to be off. 在人像模式下和手机的横向模式下(三星银河笔记2),它显示都很好,但是当我在平板电脑上尝试过(三星银河选项卡)时,纵向模式看起来仍然不错,但是在横向模式下,发生的是图像看起来失真,图像覆盖整个宽度,但高度似乎不对。

I did check it on the graphical layout but it looks ok. 我确实在图形布局上检查过它,但是看起来还不错。

this is my imageView: 这是我的imageView:

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:adjustViewBounds="true"
    android:scaleType="centerCrop"
    android:src="@drawable/footersuperlong" />

Did I do something that makes it distorted?How can I make the image correctly display on the landscape view of a tablet? 我做了使其变形的事情吗?如何使图像正确显示在平板电脑的横向视图上?

The problem is the tab's width will be more compared to mobile phone. 问题在于,与手机相比,标签的宽度会更大。 So the image get scaled up to match the width. 因此,图像会按比例放大以匹配宽度。

You should use different image for different screens. 您应该为不同的屏幕使用不同的图像。 Put different images in different drawable folder like hdpi,mdpi,xhdpi, If the images are stretchable use nine patch images. 将不同的图像放在不同的可绘制文件夹中,例如hdpi,mdpi,xhdpi。如果图像可拉伸,则使用九个补丁图像。

Define different layout for tablet sized screen. 为平板电脑大小的屏幕定义不同的布局。

checkout multiscreen support and screen_sizes for more info 签出多屏支持screen_sizes了解更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM