UKD*_*eek 62 android imageview
我有一个非常简单的图像RelativeLayout,由于某种原因,我在顶部和底部有额外的间距,我无法删除.我该如何清除它?
这是它的样子:

这是代码:
<?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/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/slice11pp" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
在你的上面imageView只需添加android:scaleType="fitXY"
您的问题可能是您没有设置比例类型...将其添加到ImageView的XML,"fitCenter"应该是正确的,但还有其他,请检查:ScaleType.
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/slice11pp"
android:scaleType="fitCenter" />
Run Code Online (Sandbox Code Playgroud)
Must be enough adding the property:
android:adjustViewBounds="true"
Run Code Online (Sandbox Code Playgroud)
for example:
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/slice11pp"
android:adjustViewBounds="true" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
34548 次 |
| 最近记录: |