【问题标题】:Imageview left and right white space issueImageview左右空白问题
【发布时间】:2017-05-31 17:27:10
【问题描述】:

我正在尝试在 imageview 中设置 1080*1920 图像,但它在左侧和右侧显示空白。它在所有分辨率为 480*800,720*1280,768*1280,1080*1920,1440*2560 的设备中显示相同。请检查附加图片另外,我尝试设置 android:adjustViewBounds="true" 但如果我设置 android:scaleType="fitXY" 图像被拉伸,它就不起作用.请帮助我提供一些解决方案,因为我正在尝试所有可能的方法,但直到现在都没有工作。

This is xml layout code :
    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/img_gallery1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        android:src="@drawable/atest"
        android:scaleType="fitXY" --> iF i use fitXY then image is streched
        android:visibility="visible" />
</RelativeLayout>

【问题讨论】:

  • 发布您的布局 xml
  • 发布您的 xml 代码。以及您要展示的图片。

标签: android image android-layout android-imageview removing-whitespace


【解决方案1】:

试试:

android:layout_width="wrap_content"  

或:

android:layout_width="match_parent"

还要确保您拥有 imageview 的任何容器都能够填满全屏。

【讨论】:

  • 请检查我的 xml 布局代码。我编辑有问题。谢谢
【解决方案2】:

您提到的分辨率,即 1920x1080 是理想的横向分辨率。

因此,如果您打算将图像置于纵向模式,请尝试将图像的分辨率更改为 1080x1920。

另外,正如 Philip 所说,确保 imageview 的容器能够填满屏幕。

【讨论】:

  • 嗨@Jubin Mathai,图片分辨率为1080*1920,是纵向尺寸
猜你喜欢
  • 2013-11-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-05-11
  • 2010-12-28
  • 2014-01-19
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多