前言

UE需要在android的文字上加上阴影效果,之前不知道原来TextView有这样一个属性可以设置文字阴影~记录一下

代码实现

    /**     * Gives the text a shadow of the specified blur radius and color, the specified     * distance from its drawn position.     * 

* The text shadow produced does not interact with the properties on view * that are responsible for real time shadows, * {@link View#getElevation() elevation} and * {@link View#getTranslationZ() translationZ}. * * @see Paint#setShadowLayer(float, float, float, int) * * @attr ref android.R.styleable#TextView_shadowColor * @attr ref android.R.styleable#TextView_shadowDx * @attr ref android.R.styleable#TextView_shadowDy * @attr ref android.R.styleable#TextView_shadowRadius */ public void setShadowLayer(float radius, float dx, float dy, int color) { mTextPaint.setShadowLayer(radius, dx, dy, color); mShadowRadius = radius; mShadowDx = dx; mShadowDy = dy; mShadowColor = color; // Will change text clip region if (mEditor != null) { mEditor.invalidateTextDisplayList(); mEditor.invalidateHandlesAndActionMode(); } invalidate(); }

备注: shadowRadius是阴影模糊半径

更多相关文章

  1. android 云标签,文字墙(文字随机排列效果)
  2. android学习笔记17:文字设置
  3. android去掉layout顶部的阴影(状态栏下边的阴影)
  4. Android中TextView 添加ClickableSpan后点击选中文字背景变色问
  5. Android阴影
  6. android PopupWindow 阴影背景 、动画 、点击显示、隐藏
  7. Android 如何实现竖排文字显示?

随机推荐

  1. 你不知道一些神奇Android Api
  2. Android 3.1 r1 中文API文档 (120) ――
  3. Android消息机制(一) Handler looper mes
  4. android:windowSoftInputMode属性
  5. Android Intent机制实例详解(Activity篇)
  6. Android 性能优化案例
  7. 【Android】窗口机制分析与UI管理系统
  8. handler机制简析
  9. 初窥 Android 模拟器 2.0,这些年来最大最
  10. Android - 小功能 - Android短信功能实现