<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@android:color/white" > <ImageButton android:id="@+id/btnSch" android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/next" /> </LinearLayout>
设置上面的代码后,ImageButton四周会有一个边框,感觉没有fill到父容器。
这是因为ImageButton有默认的背景色,如果想让ImageButton彻底fill到父容器,设置android:background="@null"后,即可达到完全填满的效果
PS.图片缩放效果可以通过android:scaleType设置。