在ImageView的中心图像的水平没有垂直居中它 [英] Center image horizontal in imageView without centering it vertically
本文介绍了在ImageView的中心图像的水平没有垂直居中它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有动力的尺寸和的ImageView
具有统计学高度的图像。
我想我的形象绑定在我的的ImageView
是这样的。
I have images with dynamical dimensions and ImageView
with statistical height.
I'm trying to bind my image in my imageView
like this.
ImageLink
我的意思是水平填补了 ImageView的,而不是垂直方向。这里是我的code
I mean to fill the ImageView
horizontally, but not vertically. Here is my code
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="280dp">
<ImageView
android:id="@+id/exploreImage"
android:src="@drawable/beard1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
但现在 ScaleType
中有的ImageView
,允许这种方式进行绑定。
But there is now ScaleType
in ImageView
, that allows this way to bind.
你有关于如何做到这一点任何想法?
Do you have any idea about how to do it?
推荐答案
将它放置在滚动视图
,改变你的的ImageView
code这样:
Place it inside a scrollview
and change your imageview
code to this:
<ImageView
android:id="@+id/exploreImage"
android:src="@drawable/beard1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
/>
这篇关于在ImageView的中心图像的水平没有垂直居中它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文