如何在 android studio 中通过触摸移动、旋转和调整文本大小?
How to move, rotate, and resize text by touch in android studio?
我使用 GestureViews 来旋转、裁剪和移动 ImageView,但我不能使用它们来旋转、调整大小和移动 TextView,因为 GestureViews 类 只能与 ImageView 一起使用。
首先,您必须将 textview 转换为 imageview。
您可以使用 buildDrawingCache() 和 getDrawingCache() 创建任何视图的位图
TextView tv = (TextView)findViewById(R.id.textview);
tv.buildDrawingCache();
ImageView img = (ImageView)findViewById(R.id.imageview);
img.setImageBitmap(tv.getDrawingCache());
此处有更多详细信息 - Create Bitmap Image from EditText & its content
然后使用触摸手势拖动和缩放屏幕上的对象,使用onTouchEvent() 拦截触摸事件。 https://developer.android.com/training/gestures/scale
我使用 GestureViews 来旋转、裁剪和移动 ImageView,但我不能使用它们来旋转、调整大小和移动 TextView,因为 GestureViews 类 只能与 ImageView 一起使用。
首先,您必须将 textview 转换为 imageview。
您可以使用 buildDrawingCache() 和 getDrawingCache() 创建任何视图的位图
TextView tv = (TextView)findViewById(R.id.textview);
tv.buildDrawingCache();
ImageView img = (ImageView)findViewById(R.id.imageview);
img.setImageBitmap(tv.getDrawingCache());
此处有更多详细信息 - Create Bitmap Image from EditText & its content
然后使用触摸手势拖动和缩放屏幕上的对象,使用onTouchEvent() 拦截触摸事件。 https://developer.android.com/training/gestures/scale