I’m looking to replicate the following within my application:

As you can see, its basically a button which increases/decreases the value of the text view contained within it. This button will have three visual states -> unpressed, decrease and increase (as seen in the image above, the user taps the increase arrows and the button appears pressed in on that side)
Here are my 3 button states currently:



As you can see, the problem I have is being able to correctly skew/rotate the text view so it looks visually correct and appears slanted along with the button when its being increased or decreased.
I have tried two different approaches so far:
-
Create a custom text view class which overrides the
onDraw()method to skew the canvas:@Override public void onDraw(Canvas canvas) { canvas.save(); canvas.skew(0.2f, 0f); super.onDraw(canvas); canvas.restore(); } -
Integrate the
Rotate3dAnimationclass (source here) and used many different variations to get the desired result such as:Rotate3dAnimation skew = new Rotate3dAnimation( 30, 0, centerX, centerY, 0, false); txtAmount.startAnimation(skew);
Unfortunately, I’m not quite getting the exact result that mirrors the first image above. I’m getting confused with setting values with the Z-axis, skew, rotate etc.
I’d greatly appreciate any help from anyone who has experience with this stuff. Thanks in advance
Well I even tried and I came up with something like this:
I got an output as:
I guess changing the values by trial and error can solve your problem.
Hope it helps.