简体   繁体   English

在Image Android上旋转,缩放和翻译TextView

[英]Rotate, Scale and translate TextView on Image Android

I have a textview with some text. 我有一些文本textview。 Textview have touch events, so user can rotate, scale and translate text. Textview具有触摸事件,因此用户可以旋转,缩放和翻译文本。 can anybody help me. 有谁能够帮助我。 Thanks in Advance. 提前致谢。

Yes First to convert textview in imageview after you can handle multitouch in your text. 是,可以先处理文本中的多点触摸,然后首先将imageview转换为imageview。

Solution: 解:

                TextView usertext = new TextView(this);
                usertext.setText("Hi Hello");
                usertext.setTextSize(22);
                usertext.setBackgroundColor(Color.TRANSPARENT);

                Bitmap testB;

                testB = Bitmap.createBitmap(TextLayout.getWidth(), TextLayout.getHeight(), Bitmap.Config.ARGB_8888);
                Canvas c = new Canvas(testB);
                usertext.layout(0, 0, 80, 100);
                usertext.draw(c);

               // create imageview in layout file and declare here

                Imageview iv = (Imageview) findviewByid(your imageview id)
                iv.setImageBitmap(testB);
                iv.setOnTouchListener(this);

Enjoy... 请享用...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM