【发布时间】:2011-10-06 20:59:45
【问题描述】:
我在尝试将按钮的背景设置为位图图像时遇到问题。我的布局 xml 文件中有以下内容:
<Button
android:id="@+id/p1b1"
android:layout_width="90px"
android:layout_height="60px"
android:layout_alignParentLeft="true"
android:background="@drawable/gridt"
android:text="" />
这只是按钮的一部分。我的 drawable-hdpi、drawable-ldpi 和 drawable-mdpi 文件夹中有 gridt.png 图像。
按钮图像只是在空按钮上显示一个白框,并且角没有圆角。
我需要在几个按钮上执行此操作,但学习如何在一个按钮上有效执行此操作将是一个很好的起点。我想使用 Button 而不是 ImageButton,因为我在按钮上也有文本。
谢谢。
【问题讨论】:
标签: android image button background