Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个图表,我想垂直显示轴的名称。但是如何沿 y 轴垂直书写呢?尝试使用textview.setRotation(270)但宽度有问题,因为垂直时宽度没有减小。
textview.setRotation(270)
您可以做的一件事是子类化TextView并覆盖其onDraw方法
TextView
onDraw
@Override protected void onDraw(Canvas canvas) { canvas.save(); canvas.translate(0, getHeight()); canvas.rotate(-90); Layout layout = getLayout(); if (layout != null) layout.draw(canvas); canvas.restore(); }