怎么让textview中的文字竖着显示
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了怎么让textview中的文字竖着显示相关的知识,希望对你有一定的参考价值。
参考技术A public class RotateTextView extends TextViewprivate static final String NAMESPACE = "
private static final String ATTR_ROTATE = "rotate";
private static final int DEFAULTVALUE_DEGREES = 0;
private int degrees ;
public RotateTextView(Context context)
super(context);
public RotateTextView(Context context, AttributeSet attrs)
super(context, attrs);
degrees = attrs.getAttributeIntValue(NAMESPACE, ATTR_ROTATE, DEFAULTVALUE_DEGREES);
public RotateTextView(Context context, AttributeSet attrs,int defStyle)
super(context, attrs,defStyle);
@Override
protected void onDraw(Canvas canvas)
canvas.rotate(degrees,getMeasuredWidth()/2,getMeasuredHeight()/2);
super.onDraw(canvas);
<com.test.RotateTextView xmlns:myrotate="
android:layout_height="wrap_content"
android:layout_marginTop="468dip"
android:padding="60dip"
android:linksClickable="true"
android:autoLink="web"
android:gravity="center"
android:id="@+id/test"
myrotate:rotate="-45"
android:textSize="20dip"
android:text="7\n\n16"/>本回答被提问者和网友采纳 参考技术B 是整个竖过来,还是字是竖着下来的?
如何让textview中的文字竖着显示
参考技术A public class RotateTextView extends TextViewprivate static final String NAMESPACE = "
private static final String ATTR_ROTATE = "rotate";
private static final int DEFAULTVALUE_DEGREES = 0;
private int degrees ;
public RotateTextView(Context context)
super(context);
public RotateTextView(Context context, AttributeSet attrs)
super(context, attrs);
degrees = attrs.getAttributeIntValue(NAMESPACE, ATTR_ROTATE, DEFAULTVALUE_DEGREES);
public RotateTextView(Context context, AttributeSet attrs,int defStyle)
super(context, attrs,defStyle);
@Override
protected void onDraw(Canvas canvas)
canvas.rotate(degrees,getMeasuredWidth()/2,getMeasuredHeight()/2);
super.onDraw(canvas);
<com.test.RotateTextView xmlns:myrotate="http://myrotate.com/apk/res/myrotate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="468dip"
android:padding="60dip"
android:linksClickable="true"
android:autoLink="web"
android:gravity="center"
android:id="@+id/test"
myrotate:rotate="-45"
android:textSize="20dip"
android:text="7\n\n16"/>本回答被提问者和网友采纳
以上是关于怎么让textview中的文字竖着显示的主要内容,如果未能解决你的问题,请参考以下文章