Skewing a text view in Android

后端 未结 2 872
无人共我
无人共我 2020-12-14 11:55

I\'m looking to replicate the following within my application:

\"enter

As you

2条回答
  •  误落风尘
    2020-12-14 12:24

    Well I even tried and I came up with something like this:

     public class DemoActivity extends TextView {
        Context context;
        String firstText = "$120.00";
    
     public DemoActivity(Context context)
       {
        super(context);
        this.context = context;
    
       }
    
    
        @Override
        protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        setText(firstText);
        setTextSize(30);
        canvas.skew(1.0f, 0.3f);  //you need to change values over here
        Rotate3dAnimation skew = new Rotate3dAnimation(
                  -20, 30,200, 200, 0, false);   //here too
        startAnimation(skew);
    
            }
        }
    

    I got an output as:

    enter image description here

    I guess changing the values by trial and error can solve your problem. Hope it helps.

提交回复
热议问题