android中文字斜着显示
/** * 自定义一个Textview * * @author Administrator * */ public class MyTextView extends TextView { public MyTextView(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onDraw(Canvas canvas) { // 倾斜度45,上下左右居中 canvas.rotate(-45, getMeasuredWidth() / 2, getMeasuredHeight() / 2); super.onDraw(canvas); } }
//xml文件中添加上这个MyTextView <com.xhm.test.incline_textview.MyTextView android:layout_width="100dip" android:layout_height="100dip" android:gravity="center" android:text="@string/hello_world"/>