mikebai.com

  • Home
  • dev
  • DotNET
  • M365
  • 搞笑
  • 杂七杂八
  • FocusDict
個人BLOG
it developer
  1. Main page
  2. dev
  3. Main content

ImageButton"边框"的问题

2012-04-12 104hotness 0likes 0comments

<?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设置

Tag: Nothing
Last updated:2012-04-12

mikebai

This person is a lazy dog and has left nothing

Like
< Last article
Next article >

COPYRIGHT © 2025 mikebai.com. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang