• 设置ImageButton的图片可通过android:src属性,也可以通过setImageResource(int)方法来实现。
  • ImageButton所显示的图片若不能完全覆盖掉背景色时,使用ImageButton一般要将背景色设置为其他图片或直接设置为透明。

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:andro />
    </TableRow>
</TableLayout>

其中ImageButton的 android:src在drawable-mdpi中新建myselector.xml:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:andro />
</selector>

Android 常用基本控件 ImageButton

当按下ImageButton后,显示如下:

Android 常用基本控件 ImageButton

相关文章:

  • 2022-02-05
  • 2022-12-23
  • 2021-10-05
  • 2021-10-14
  • 2021-12-16
  • 2021-12-23
  • 2021-06-25
猜你喜欢
  • 2021-06-16
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2022-12-23
  • 2021-09-12
相关资源
相似解决方案