2016-03-05 73 views
0

我创建了一个android应用程序。现在,当方向为垂直方向的图像加载罚款,这是我希望它喜欢这个 vertical OrientationImageView的图像在水平方向上定位错误

` 但是当我打开设备水平这一形象被设定在imageview的左下角的正确方法 horizontal Orientation

的XML为ImageView的是如下面`

 <ImageView 
      android:id="@+id/backdrop" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:scaleType="matrix" 
      android:fitsSystemWindows="true" 
      app:layout_collapseMode="parallax" /> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
      app:layout_collapseMode="pin" /> 

what is the reason causing this behavior ?? is it due to机器人:scaleType = “矩阵”`属性??任何帮助将不胜感激。

回答

0

由于ImageView的scaleType,如果您希望图像填充整个容器,则需要使用不同的scaleType(如fillXY或CenterCrop)。

如果你想掌握这个主题,你可以检查this文章比较每个scaleType,并决定哪一个适合您的最佳需求。

+0

我真正想要的是,图像的左上角应该与imageview的左上角重合,因为海报比设备屏幕大得多。任何想法如何做到这一点? – Infamous

+0

尝试用fitStart –

+0

nop bro ..没有工作,实际上使情况变得更糟糕..l0 – Infamous

0

Matrix可能不是你想要使用的。试试centerInsidecenterCrop,看看你最喜欢哪一个。其他变化可以发现here

+0

没有任何值,如CENTER_INSIDE或CENTER_CROP – Infamous

+0

@Infamous对不起,指的是设置它的程序化方式,调整了我的文章 –

+0

你是否知道图像的左上角应该如何与imageview的左上角重合,因为海报是比相当大的设备screeen.when设备是垂直'android:scaleType =“矩阵”'正是我想要做的 – Infamous