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

图片资源:    


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中的style和theme的用法
  4. Android(安卓)中获取未安装APK的 图标 || icon
  5. Android(安卓)、BlackBerry 文本对齐方式对比
  6. Android(安卓)利用ScaleDrawable实现缩放
  7. android主流UI布局
  8. Android(安卓)Material Design 实践(六)--MaterialNavigationDra
  9. Android(安卓)PullToRefreshView巴黎埃菲尔铁塔效果

随机推荐

  1. php levenshtein函数怎么用
  2. php中的count_chars函数怎么用
  3. php中的array_search函数怎么用
  4. php中的str_word_count函数怎么用
  5. php中的array_slice函数怎么用
  6. php中的similar_text函数怎么用
  7. php中的array_shift函数怎么用
  8. php中的substr_replace函数怎么用
  9. php中的array_merge函数怎么用
  10. php中的substr_count函数怎么用