ImageButton的问题

http://img.mukewang.com/57ee1f7200014a3e09720304.jpg

宽高不确定的情况下,图片下方的那段空白怎么去掉。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical">

    <ImageButton
        android:id="@+id/imageButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#00000000"
        android:scaleType="fitStart"
        android:src="@drawable/aaa5"
       />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="123"
        android:textSize="30sp"/>
</LinearLayout>


慕仰6620973
浏览 1325回答 4
4回答

小罗希冀

你好,建议你把ImageButton中的scaleType属性修改一下,你选择的FIT_START的作用是填充于屏幕上方,并等比例缩放、你可以尝试一下把属性设置成center

慕仰6620973

。。。自己整出来了用这个android:adjustViewBounds="true"就可以。。

dky

用imageview

weibo_土豆fighting_0

设置 ImageButton的属性 android:background = "@null"
打开App,查看更多内容
随时随地看视频慕课网APP