Skip to content

setBackgroundDrawable 废弃修改 #1

Description

@756718646

//强迫症,看到
//设置背景推荐加入这个工具类
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);

     }

 }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions