android 弧形文字怎么实现

android 弧形文字怎么实现,第1张

因为你描述的不够清楚,我只能按照自己的理解写了下。比较粗糙,而且因为用到了差值动画,所以适用于3.0以上的android系统,你给自己的TextView或EditText添加个文字改变监听,例如: 你的文本控件.addTextChangedListener(new TextWatcher(){})然后重写onTextChangedfang方法,在里面调用下面的方法就行了。里面的效果我暂时写死了,你可以根据需要自己修改参数。private void changeTextAlpha(final TextView target){ final int color = target.getCurrentTextColor() target.setTextColor(0 * 0x1000000 + color) //设置起始与结束值(透明度),从0到255渐变 ValueAnimator valueAnimator = ValueAnimator.ofInt(0, 255) valueAnimator.setEvaluator(new IntEvaluator()) //设置插值器,线性(匀速)渐变 valueAnimator.setInterpolator(new LinearInterpolator()) valueAnimator.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { int alpha = (Integer)animator.getAnimatedValue() target.setTextColor(alpha * 0x1000000 + color) } }) //持续时间3秒 valueAnimator.setDuration(3000).start() }

在幻灯片中插入一个“自选图形”中的基本形状里的空心弧;

选中空心弧,单击鼠标右键,执行添加文字命令;

插入艺术字,选中艺术字样式中的圆弧形文字样式,输入文字;

调整艺术字的控制柄,与弧形文本框相适应。

这样就制作出弧形文本框,其内的文字按弧形排布。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/11606099.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-17
下一篇2023-05-17

发表评论

登录后才能评论

评论列表(0条)

    保存