如何删除Android的额外空间的ImageView [英] How to delete Additional space ImageView in Android

查看:281
本文介绍了如何删除Android的额外空间的ImageView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用的ImageView 在我的项目,但它显示在布局额外的空间。我怎样才能去掉额外的空间?

I want use ImageView in my project, but it shows additional space in the layout. How can I remove the additional space?

此图显示了问题:

示例图像

XML code:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    tools:context="com.tellfa.smsbox.activities.Dialog_image_show">

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:src="@drawable/cover_menu_bg" />

    </RelativeLayout>

</RelativeLayout>

我不希望使用的android:scaleType =centerCrop

推荐答案

使用的ImageView的像这样的

Use the imageview like these

<ImageView
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:adjustViewBounds="true"
   android:src="@drawable/icon"
   android:id="@+id/imv"
   android:scaleType="fitCenter" />

这篇关于如何删除Android的额外空间的ImageView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆