简体   繁体   English

我的Alpha动画文件的布局

[英]Layout of my Alpha Animation File

First of all Im trying to animate a TextView view in one of my app's but it doesn't seem to work. 首先,我试图在我的一个应用程序中为TextView视图设置动画,但它似乎无法正常工作。 I believe the answer lies in the alpha.xml file; 我相信答案就在alpha.xml文件中。 I keep getting an error from this file but can't determine why: 我不断从此文件中获取错误,但无法确定原因:

<?xml version="1.0" encoding="utf-8"?>
<alpha
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromAlpha="0.0"
    android:toAlpha="1.0"
    android:duration="3000">
</alpha>

Also I later want to animate an entire activity before it appears. 另外,我后来想在整个活动之前对其进行动画处理。 This screen will simply be the splash/load screen an should animate on over a period of time. 该屏幕将只是启动/加载屏幕,并应在一段时间内进行动画处理。

Any ideas? 有任何想法吗? Cheers 干杯

The java code which uses it goes like this: 使用它的Java代码如下所示:

private void RunAnimations() 
        {
        Animation a = AnimationUtils.loadAnimation ( this, R.anim.alpha );
        a.reset();

        TextView tv = (TextView) findViewById( R.id.welcomeMessage );
        tv.clearAnimation();
        tv.startAnimation( a );
    }

The error in the XML file is: XML文件中的错误是:

Multiple annotations found at this line: - Element type "alpha" must be followed by either attribute specifications, ">" or "/ 在此行找到多个注释:-元素类型“ alpha”后必须是属性说明“>”或“ /

". - error: Error parsing XML: not well-formed (invalid token) “-错误:解析XML时出错:格式不正确(无效的令牌)

:/ :/

我对其进行了整理-由于某种原因,我不得不使用set.xml,然后向其中添加Alpha以使其正常工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM