我想在我的项目中缩放、移动和放大、缩小 Textview。 是否有用于执行此任务的库?
Refere App TextGram 我想像这样制作 https://play.google.com/store/apps/details?id=codeadore.textgram
所有这些都像剪贴画、贴纸等一样完成,我只在像这样绘制文本时遇到问题。
最佳答案
View Animation
是您所需要的。例如,在 res/anim
文件夹中制作 myanim.xml
,内容如下:
<set android:shareInterpolator="false">
<scale
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fromXScale="1.0"
android:toXScale="1.4"
android:fromYScale="1.0"
android:toYScale="0.6"
android:pivotX="50%"
android:pivotY="50%"
android:fillAfter="false"
android:duration="700" />
<set android:interpolator="@android:anim/decelerate_interpolator">
<scale
android:fromXScale="1.4"
android:toXScale="0.0"
android:fromYScale="0.6"
android:toYScale="0.0"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="700"
android:duration="400"
android:fillBefore="false" />
<rotate
android:fromDegrees="0"
android:toDegrees="-45"
android:toYScale="0.0"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="700"
android:duration="400" />
</set>
</set>
在你的Activity
类中:
TextView mText = (TextView) findViewById(R.id.textViewId);
Animation myAnim = AnimationUtils.loadAnimation(this, R.anim.myanim);
mText.startAnimation(myAnim);
关于android - 如何缩放,移动和放大,缩小Textview?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28735084/