读书人

将字体旋转一上

发布时间: 2012-09-27 11:11:17 作者: rapoo

将字体旋转一下

今天突然想起这个问题 然后试了一下其实也不难

public class UpsideDownText extends TextView? {

?@Override
?protected void onDraw(Canvas canvas) {
??// TODO Auto-generated method stub
??
????????? canvas.save();??
?
?????????????? float py = this.getHeight()/2.0f;
??????? float px = this.getWidth()/2.0f;
???????
??????? canvas.rotate(180, px, py);??
???????
???????????????
??????? super.onDraw(canvas);
??????
??????? canvas.restore();
?}

?public UpsideDownText(Context context, AttributeSet attrs, int defStyle) {
??super(context, attrs, defStyle);
??// TODO Auto-generated constructor stub
?}

?public UpsideDownText(Context context, AttributeSet attrs) {
??super(context, attrs);
??// TODO Auto-generated constructor stub
?}

?public UpsideDownText(Context context) {
??super(context);
??// TODO Auto-generated constructor stub
?}

}

读书人网 >移动开发

热点推荐