我有这个ImageView:
<ImageView
android:id="@+id/myImage"
android:sec="@drawable/my_selector"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_alignParentLeft="true"
android:scaleType="fitCenter"
android:adjustViewBounds="true" />
问题是我在ImageView内部的图像两侧不断出现空格。如果我将比例类型更改为fitStart,则图像只会向右移动,其右侧有一个非常大的空间(与fitCenter一起的两个空格的总和)。
如何删除此空间?
答案 0 :(得分:0)
我认为你的ImageView对于你的图像大小来说非常大。
您必须使用其中一个中心标签。可能在Centerinside。
答案 1 :(得分:0)
您可以维持imageview的宽高比,看看 MH给出的answer。
答案 2 :(得分:0)
似乎问题出在Eclipse的图形布局本身。看起来问题只是图像非常大而且图形布局窗口没有像设备中的实际视图那样正确显示图像,在那里我看到了一个非常大的图像,适合图像视图。 当缩小图像的大小时,它就成功了。
答案 3 :(得分:0)
尝试将scaleType更改为fitXY
,matrix
或center
,如:
<ImageView
android:id="@+id/myImage"
android:sec="@drawable/my_selector"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_alignParentLeft="true"
android:scaleType="fitXY"
android:adjustViewBounds="true" />
查看此page了解详情。