Android ImageButton Example 图片按钮
Android ImageButton Example 图片按钮
使用“android.widget.ImageButton” 展现一个具有背景图片的按钮
本教程将展现一个具有名字为 c.png背景图片的按钮。当用户点击该图片按钮,弹出提示信息。1. 添加 .png 图片资源:
将 “android_button.png” 文件,放到 res/drawable-hdpi 目录下
2. 添加 ImageButton 标记
打开 “res/layout/activity_main.xm” 文件, 添加 “ImageButton” 标记。
通过 “android:src“ 引用图片资源
File : res/layout/activity_main.xm
点击图片按钮:
参考文献:
http://www.mkyong.com/android/android-imagebutton-example/