Android 如何设置已在xml中定义的TextView的背景动画?
例如,我将以下内容作为TextView的背景:Android 如何设置已在xml中定义的TextView的背景动画?,android,xml,animation,textview,Android,Xml,Animation,Textview,例如,我将以下内容作为TextView的背景: 在主要活动中,我有: txtMessageData = (TextView) findViewById(R.id.txtMessageData); 背景在xml中设置为: <TextView . . android:background="@drawable/pulsator /> 我认为您可以使用线性布局,并将文本视图放入其中,然后设置此线性布局的动画。。。试试看。直到我知道你可以设置文本视图的动画,但不能设置背景 <?
在主要活动中,我有:
txtMessageData = (TextView) findViewById(R.id.txtMessageData);
背景在xml中设置为:
<TextView
.
.
android:background="@drawable/pulsator />
我认为您可以使用线性布局,并将文本视图放入其中,然后设置此线性布局的动画。。。试试看。直到我知道你可以设置文本视图的动画,但不能设置背景
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="1500"
android:fromAlpha="1.0"
android:interpolator="@android:anim/linear_interpolator"
android:toAlpha="0.0"
/>
<scale
android:duration="1500"
android:fromXScale="1.0"
android:toXScale="2.5"
android:fromYScale="1.0"
android:toYScale="2.5"
/>
</set>