getDrawable过时的替代方法

来源:互联网 发布:linux系统启动流程简述 编辑:程序博客网 时间:2024/05/22 02:05
  • 当你这个Drawable不受主题影响时

    ResourcesCompat.getDrawable(getResources(), R.drawable.name, null);
  • 当你这个Drawable受当前Activity主题的影响时

    ContextCompat.getDrawable(getActivity(), R.drawable.name);
  • 当你这个Drawable想使用另外一个主题样式时

    ResourcesCompat.getDrawable(getResources(), R.drawable.name, anotherTheme);



  • 链接:http://www.jianshu.com/p/21558fe8b750

    阅读全文
    0 0
    原创粉丝点击