源码中是酱紫声明的
/**
* @deprecated use {@link #setBackground(Drawable)} instead
*/
@Deprecated
public void setBackgroundDrawable(Drawable background) {
}然后找到这个方法
/**
* Set the background to a given Drawable, or remove the background. If the
* background has padding, this View's padding is set to the background's
* padding. However, when a background is removed, this View's padding isn't
* touched. If setting the padding is desired, please use
* {@link #setPadding(int, int, int, int)}.
*
* @param background The Drawable to use as the background, or null to remove the
* background
*/
public void setBackground(Drawable background) {
//noinspection deprecation
setBackgroundDrawable(background);
}你确定这不是在逗我玩?
本文讨论了 Android 中已废弃的 setBackgroundDrawable 方法,并展示了如何使用新的 setBackground 方法来替代它。文章通过对比两个方法的实现方式,解释了为何建议使用新的 API。
521

被折叠的 条评论
为什么被折叠?



