如何在Android中使用textview显示颠倒文本?
在我的情况下,我有一个2人游戏,他们互相玩耍.我想向面向他们的第二个玩家展示测试.
这是我在AaronMs建议之后实施的解决方案
执行覆盖的类bab.foo.UpsideDownText
package bab.foo;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.widget.TextView;
public class UpsideDownText extends TextView {
//The below two constructors appear to be required
public UpsideDownText(Context context) {
super(context);
}
public UpsideDownText(Context context, AttributeSet attrs)
{
super(context, attrs);
}
@Override
public void onDraw(Canvas canvas) {
//This saves off the matrix that the canvas applies to draws, so it can be restored later.
canvas.save();
//now we change the matrix
//We need to rotate around the center of …Run Code Online (Sandbox Code Playgroud)