How to create a vertical TextView (rotated 90 ° or -90 °) with ellipsis support (this means that the text is truncated if there is not enough space in the view, and "..." as added to indicate truncation) that can be calculated with dp is the value, wrap_content and match_parent ?
All other TextView parameters must also be satisfied.
Also, he does not need additional code to perform turns or otherwise, and he must correctly display in the UI editor.
This solution works fine, however overriding onDraw() means that the ellipsis functions and other functions no longer work. The text will simply disappear if it is too large to display, or something else happens.
The ok rotation is shown below, but the ellipsis is calculated based on the viewing width, it should be based on the height if it rotates 90 °.
protected void onDraw(Canvas canvas) { canvas.save(); canvas.rotate(90, 0, getPaint().getTextSize() +5); super.onDraw(canvas); canvas.restore(); }
android:rotation in TextView is not a good solution since positioning and size are not working properly.
As an option, the view should allow you to rotate the text at any angle.
source share