XML Animation List Duration not working

In summary, the user is creating a border for an image view using XML code. The border appears but does not disappear after 2 seconds as desired. It is suggested that the duration is specified in milliseconds, and possibly additional items are needed in the animation list for the border to disappear. The standard for milliseconds in Android development is referenced.
  • #1
whitehorsey
192
0
I am creating a border for an image view using xml. This is what I have:

<animation-list xmlns:android="http://schemas.android.com/apk/res/android" >

<item android:duration="200">
<shape
android:shape="rectangle" >
<stroke
android:width="5dp"
android:color="#FF0000" />
<solid android:color="#000099" />
</shape>
</item>
</animation-list>

The border shows up but it stays with the imageview and does not disappear. I want it to disappear after 2 seconds. What is wrong?
 
Last edited by a moderator:
Technology news on Phys.org
  • #2
I'm sorry you are not generating any responses at the moment. Is there any additional information you can share with us? Any new findings?
 
  • #3
A problem is that you are specifying 200 instead of 2000 msec.
I have never programmed an android, but just as a guess, do you need additional items in your animation list?
Are you expecting the box to disappear once your list is complete?
 
  • #4
.Scott said:
A problem is that you are specifying 200 instead of 2000 msec.
I have never programmed an android, but just as a guess, do you need additional items in your animation list?
Are you expecting the box to disappear once your list is complete?
Unless the code isn't using the standard of milliseconds. Maybe it's waiting 200 seconds (3 1/2 minutes) to go away.
 

FAQ: XML Animation List Duration not working

1. Why is my XML animation list duration not working?

There could be several reasons for this issue. One common reason is that the duration value is not set correctly in the XML code. Make sure the duration is specified in milliseconds and not in seconds. Another possible reason is that the animation is being overridden by other CSS styles. Check if there are any conflicting styles that may be affecting the animation duration.

2. How can I fix the XML animation list duration not working?

If the issue is with the duration value, simply correcting it in the XML code should fix the problem. If the issue is with conflicting styles, you can try using the !important declaration to give priority to the animation duration specified in the XML. Another solution is to use inline styles instead of external CSS, as inline styles have higher priority over external stylesheets.

3. Can the duration of an XML animation list be set to a variable or dynamic value?

Yes, the duration value can be set to a variable or a dynamically calculated value using JavaScript. This allows for more flexibility in creating dynamic animations. Make sure to update the duration value before triggering the animation.

4. Does the browser version affect the XML animation list duration?

The duration of an XML animation list should not be affected by the browser version, as long as the browser supports CSS animations. However, different browsers may have different default animation speeds, so it is important to test and adjust the duration accordingly for cross-browser compatibility.

5. Is there a limit to the duration of an XML animation list?

There is no specific limit to the duration of an XML animation list. However, using extremely long durations may affect the performance of the animation, especially on older browsers. It is recommended to keep the duration within a reasonable range for optimal performance.

Similar threads

Replies
6
Views
6K
Replies
2
Views
8K
Back
Top