Questions tagged [animationdrawable]

An object used to create frame-by-frame animations in Android. Generally defined as an XML file, placed in the res/drawable/ folder.

An object used to create frame-by-frame animations in Android. Generally defined as an XML file, placed in the res/drawable/ folder. Reference: https://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html

153 questions
3
votes
0 answers

Android Single Animation Drawable Instance used in Multiple Views

I have an android AnimationDrawable which contains a large animation.(24 frame each 100x100 pixels). I want to show this animation in multiple views with different sizes, simultaneously and synchronously. I mean when view1 is showing frame1, all…
Sina Rezaei
  • 529
  • 3
  • 24
3
votes
2 answers

Repeat AnimationDrawable for infinite number and stop it on button click

I have created an AnimationDrawable and i want to repeat that animation for infinite number and stop that animation on a button click, i am sharing my code anim.xml file
Zubair Akber
  • 2,760
  • 13
  • 30
3
votes
1 answer

Can I preload an Animation Drawable?

I'm using Android's Animation Drawable to show an animation. However I want it to be as snappy as possible, because I want it to show whenever the screen is touched. The way it is now it is too slow. It takes around 500 ms to show up. Is there a way…
3
votes
1 answer

Android AnimationDrawable returning null pointer exception

My main objective for this is to get it to have a "button" that initially is dark and when pressed cycles through the animation of it lighting up in a clockwise direction like a progress bar. But I can't seem to get animationdrawable working at…
Shifty
  • 303
  • 2
  • 16
3
votes
3 answers

Add AnimationDrawable (PNG Sequence) to Canvas?

I have started venturing into a bit of Canvas stuff and managed to add some statis PNG files to it. Now I'd like to load in a PNG sequence, which I believe is an AnimationDrawable (rather then Bitmap) I have written the XML file for the animation…
Mr Pablo
  • 4,109
  • 8
  • 51
  • 104
3
votes
0 answers

How to create a simple animation in android

I want to know what is the best when I want to create a simple animation in android, for example if I have a character face and I want to move the eyes fron right to left and so on. I suggest yo use AnimationDrawable , is that a good practice ? At…
Adham
  • 63,550
  • 98
  • 229
  • 344
2
votes
0 answers

How to save an AnimationDrawable as a GIF?

i want to create a gif, i have created a animation using AnimationDrawable as shown below. for (Bitmap bitmap: bitmaps) { animation.addFrame(new BitmapDrawable(getResources(), bitmap),…
Tsar
  • 63
  • 2
  • 10
2
votes
2 answers

Add an AnimationDrawable to BottomNavigationView

I've added a BottomNavigationView to my project and I want to add an animation to one of the menu items. This animation is an AnimationDrawable, basically a sequence of images. I've done the following but didn't work, any idea of how can I reach…
2
votes
1 answer

How to load animation-lists with Picasso?

I get out of memory exceptions when loading images into my app. I integrated Picasso to load images, but the code below is not working with an animation-list for an AnimationDrawable. The animation is…
Christian
  • 317
  • 1
  • 14
2
votes
1 answer

Run multiple animations without noticeable lag

I am developing a simple 2D game. The game starts with one animation, then the players taps on screen and another animation is supposed to run without a noticeable lag while switching to next animation. My first approach was to use AnimationDrawable…
sziraqui
  • 5,763
  • 3
  • 28
  • 37
2
votes
6 answers

ImageView with rotation in Android

I need to make an imageview with rotation feature. So I looked at the android developers site. And used their codes. But somehow I get an error. Error:java.lang.ClassCastException: android.graphics.drawable.StateListDrawable cannot be cast to…
2
votes
0 answers

Frame change event for AnimationDrawable android

I have created an object of AnimationDrawable with Bitmap frames. Next what I want to do is, to perform a function every time the Frame changes in that Animation. But I have no idea how I will be able to achieve this. Is there any inbuilt or custom…
AndyN
  • 1,742
  • 1
  • 15
  • 30
2
votes
2 answers

how to set up an animated toggle button in android

I've created an animated toggle button the way someone did in this SO question. It works fine but there's a little problem, when the layout is first created, my toggle button background is first frame of the animationdrawable (it should be its last…
MamadTell
  • 163
  • 1
  • 12
2
votes
0 answers

Animating drawable inside imagebutton (using icondrawable)

I am looking to animate a drawable inside imagebutton. I have created a drawable using https://github.com/JoanZapata/android-iconify/ Drawable d= new IconDrawable(this, MaterialIcons.md_phone_locked).colorRes(R.color.white_smoke).actionBarSize(); …
Veeru
  • 4,936
  • 2
  • 43
  • 61
2
votes
0 answers

AnimationDrawable: Right way to free memory

What is the right way to free memory when using AnimationDrawable? Right now I am using: for (int frameCounter = 0; frameCounter < animation.getNumberOfFrames(); ++frameCounter) { Drawable frame = animation.getFrame(frameCounter); if (frame…
Jason Oviedo
  • 459
  • 1
  • 5
  • 16
1
2
3
10 11