安卓开发:用ImageView放上图片后上下有间隙

想不到在我使用第一个UI控件ImageView时候就遇上了问题,简单使用ImageView如下:

<ImageView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/homePage"
    />

图片显示在屏幕上,上下总是有间隙,后面一顿搜索,发现只需要加上一行代码就能搞定,如下:

<ImageView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/jianzhi"
    android:adjustViewBounds="true"/>

参考:【https://blog.csdn.net/qq_34475058/article/details/53423026

文章截图:

猜你喜欢

转载自www.cnblogs.com/cchHers/p/11308618.html
今日推荐