android之setBackgroundDrawable()
16lz
2021-01-26
转于:http://houwanji.blog.163.com/blog/static/16227622009724113953183/
--------------------------------------------------------------------------------------------------------
setBackgroundDrawable()的用法
设置控件的背景图片:如下所示
ImageButton btn = (ImageButton)findViewById(R.id.button2);
Drawable dr = this.getResources().getDrawable(R.drawable.icon); //取得图片资源
btn.setBackgroundDrawable(dr); //设置btn的背景图片
更多相关文章
- android 动画一 (帧动画FrameAnimation)
- android view画图
- Qt for Android程序沉浸式启动页面(去除标题栏、去除黑屏、保留后
- 关于Android(安卓)Genymotion 运行DDMS报ADB server didn't ACK
- Android(安卓)WebView设置代理及账号密码
- 聊聊 RN 中 Android(安卓)提供 View 的那些坑
- Android(安卓)自定义自由选择时间区间的日历控件
- Android通知栏Notification的实现
- Android(安卓)WebView使用的技巧与一些坑