BitmapDrawable deprecated alternative

前端 未结 3 2130
星月不相逢
星月不相逢 2020-12-01 02:37

I have the following code that will rotate a drawable by a set amount of degrees.

    public Drawable rotateDrawable(float angle, Context context)
    {
             


        
3条回答
  •  失恋的感觉
    2020-12-01 02:56

    Try this Once.

    1. In Activity

      BitmapDrawable background = new BitmapDrawable(this.getResources(), blurImageBg);
      
    2. In Fragment

      BitmapDrawable background = new BitmapDrawable(getActivity(), blurImageBg);
      
    3. In Adapter or else

      BitmapDrawable background = new BitmapDrawable(context.getResources(), blurImageBg);
      

提交回复
热议问题