bkit4u
bkit4u

Reputation: 9

Rotate one character in string TextView Android

I'm learning Android and I have a problem when I try rotate one character in string TextView in Android, example string :"v Magic Skin" and I want to rotate character "v" 180 degrees. It's like magic skin in camera 360.

camera 360 (sorry, i cant upload image because i haven't 10 reputation )

In camera360, when you hide or show toolbar " v Magic Skin". If you hide, "v" character will rotate 180 degrees. I search many solution rotate character like that but no result. Please can anyone help me and give me some example ????

P/S: my english not good

Upvotes: 0

Views: 457

Answers (2)

Manikanta
Manikanta

Reputation: 223

If you are writing the text using canvas, then you can simply rotate the canavs and write the text and restore the canvas.

generic code

@Override
    public void draw(Canvas canvas, CharSequence text, int start, int end,
            float x, int top, int y, int bottom, Paint paint)
    {
        if (start >= end) {
            return;
        }
        canvas.save();
        canvas.translate(x, y);
        canvas.rotate(180);
        canvas.drawText("v", x1, y1, paint);
        canavs.restore();
        // draw rest of text
}

Upvotes: 1

Miki Franko
Miki Franko

Reputation: 687

I think rather than rotate the text, you might put a picture of V and just when you want, replace the image in the image of V reversed.

Upvotes: 0

Related Questions