商城类产品 在右上角添加状态的倾斜字体
这是需求  

需要自定义控件继承textview,一下是代码 

@SuppressLint("AppCompatCustomView")
public class RotateTextView  extends TextView {



    public RotateTextView(Context context) {
        super(context);
    }

    public RotateTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        //倾斜度45,上下左右居中
        canvas.rotate(45, getMeasuredWidth()/2, getMeasuredHeight()/2);
        super.onDraw(canvas);
    }
}
        


布局文件
商城类产品 在右上角添加状态的倾斜字体
  亲测有效具体布局适当调节

相关文章:

  • 2021-09-21
  • 2022-12-23
  • 2021-09-01
  • 2023-04-02
  • 2022-12-23
  • 2022-02-20
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-18
  • 2022-01-18
  • 2022-12-23
  • 2021-12-05
  • 2021-11-20
  • 2022-12-23
相关资源
相似解决方案