Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setBackgroundDrawable 废弃修改 #1

Open
756718646 opened this issue Apr 10, 2017 · 1 comment
Open

setBackgroundDrawable 废弃修改 #1

756718646 opened this issue Apr 10, 2017 · 1 comment

Comments

@756718646
Copy link

756718646 commented Apr 10, 2017

//强迫症,看到
//设置背景推荐加入这个工具类
public static void setBackground(View view, Drawable drawable) {

     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {

         //大于API-16
         view.setBackground(drawable);

     } else {

         //小于API-16
         view.setBackgroundDrawable(drawable);

     }

 }
@maoruibin
Copy link
Owner

其实这个功能,你可以在自己项目中加一个 Util 方法,把它放在 lib 中不一定合适。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants