Android TextView文字旋转45°效果图如图:

Android TextView文字旋转45°_第1张图片

图片资源:    


RotateTextView:

import android.content.Context;import android.graphics.Canvas;import android.util.AttributeSet;import android.widget.TextView;/** *  * @author Tyler * @time 2015-11-25 下午1:45:07 */public class RotateTextView extends TextView{        public RotateTextView(Context context) {        super(context);    }        public RotateTextView(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:

    <包名.RotateTextView        android:layout_width="54dip"        android:layout_height="54dip"        android:layout_alignParentRight="true"        android:background="@drawable/e_rotate_bg2"        android:gravity="center"        android:paddingBottom="17dp"        android:text="进行中"        android:textColor="#fff"        android:textSize="12sp" />



更多相关文章

  1. android 图片点击一下就放大到全屏,再点一下就回到原界面
  2. Android 显示网页图片
  3. android 图片与byte数组间的转换
  4. android 图片灰度处理的处理
  5. 轮播网络图片加载适配
  6. Android WebView 图片自适应屏幕宽度
  7. android 通过滚动条改变图片显示
  8. android 图片水平显示,类Gallery效果

随机推荐

  1. Android(安卓)通知栏显示与设置
  2. Android分包MultiDex源码分析
  3. Android消息机制(二)
  4. ubuntu下给android虚拟机安装apk软件
  5. 【转】Android面试题大集合
  6. Android应用开发之获取web服务器xml数据
  7. Android(安卓)装载器---在应用程序中使用
  8. Android(安卓)Donut Makefile分析 (build
  9. Android(安卓)Layout 布局
  10. 在Android程序代码中实现软件安装和卸载