当前位置:网站首页>'setbackgrounddrawable() 'is deprecated, setbackgrounddrawable is obsolete
'setbackgrounddrawable() 'is deprecated, setbackgrounddrawable is obsolete
2022-06-10 12:59:00 【yechaoa】
setBackgroundDrawable() stay API 16(4.1) It's out of date
4.1 Then there are two ways to replace :
a、setBackgroundResource
b、setBackground
for example :
textView.setBackgroundResource(R.drawable.icon);
textView.setBackground(ContextCompat.getDrawable(this, R.drawable.icon));setBackgroundResource Method is called internally setBackground Method , and setBackground The internal call is still setBackgroundDrawable Method
setBackground Source code :
public void setBackground(Drawable background) {
//noinspection deprecation
setBackgroundDrawable(background);// here
}setBackgroundResource Source code :
@RemotableViewMethod
public void setBackgroundResource(@DrawableRes int resid) {
if (resid != 0 && resid == mBackgroundResource) {
return;
}
Drawable d = null;
if (resid != 0) {
d = mContext.getDrawable(resid);
}
setBackground(d);// Notice the call here
mBackgroundResource = resid;
}边栏推荐
- Recommended learning materials for Altium Designer
- Program, calculate 2/1+3/2+5/3+8/5 Value of. It is required to calculate the sum of the first n items and keep 2 decimal places (starting from the second item of the sequence, the numerator of each it
- Count the number and average value of natural numbers whose sum of bits within 100 is 7
- Stm32f407 learning notes (1) -exti interrupt event and NVIC register
- Xshell 评估期已过怎么办? 按照以下步骤即可解决!
- Automatic Mapping of Tailored Landmark Representations for Automated Driving and Map Learning 论文阅读
- Sparkstreaming real-time data warehouse question & answer
- Element close and destroy the pop-up box: clear the data cache in the pop-up box (organize)
- colmap源码阅读笔记[1] threading.cc
- Code free may event Microsoft low code matrix update; Multiple industry reports released
猜你喜欢

Summary of Kitti related information

【移动机器人】轮式里程计原理

Vdo-slam: a visual dynamic object aware slam system paper reading

ASP. Net using imagemap control to design navigation bar

VDMA调试总结

日本版arXiv凉得一批:2个多月了,才收到37篇论文

谷歌提出超强预训练模型CoCa,在ImageNet上微调Top-1准确率达91%!在多个下游任务上SOTA!

Leetcode 96. 不同的二叉搜索樹

JTAG to Axi master debugging Axi Bram controller

IQR箱线图
随机推荐
Code free may event Microsoft low code matrix update; Multiple industry reports released
Stm32f407 clock tree and system clock learning notes
Asynchronous export of Excel
2022年6月中国数据库排行榜:TiDB卷土重来摘桂冠,达梦蛰伏五月夺探花
Count the number and average value of natural numbers whose sum of bits within 100 is 7
Sparkstreaming real-time data warehouse question & answer
Which EDA design software should Altium Allegro pads choose
Technology sharing | quick intercom, global intercom
In June, 2022, China Database ranking: tidb made a comeback to win the crown, and Dameng was dormant and won the flowers in May
手机厂商“返祖”,只有苹果说不
已拿offer,进阶学习
【移动机器人】轮式里程计原理
实战案例,深入剖析
JS global timer case
JS click the button to slide to the left
Stereo vision based semantic 3D object and ego motion tracking for automotive driving
[golang] when creating a structure with configuration parameters, how should the optional parameters be transferred?
JTAG-to-AXI Master调试AXI BRAM Controller
MySQL 服务演进
微信web开发工具使用教程,公司开发web