Questions tagged [transitiondrawable]

An [tag:Android] graphics class that is an extension of LayerDrawables and is intended to cross-fade between the first and second layer.

TransitionDrawable is an graphics class that is an extension of LayerDrawables and is intended to cross-fade between the first and second layer. To start the transition, call 'startTransition(int)'. To display just the first layer, call resetTransition().

It can be defined in an XML file with the <transition> element. Each Drawable in the transition is defined in a nested <item>. For more information, see the guide to Drawable Resources.

32 questions
30
votes
5 answers

Crossfading using TransitionDrawable not working on android

I have two Images that I want to cross fade. Initially they both use imageview. I then use .getDrawable() to get the drawable of the images. This is the code I used Drawable backgrounds[] = new Drawable[2]; backgrounds[0] =…
Jack Sparrow
  • 385
  • 3
  • 5
  • 13
5
votes
1 answer

Set TransitionDrawable with ImageView ScaleType

I have got this code to crossfade the background of an ImageView: private void setWithCrossfade(Bitmap bitmap) { //create drawable vector Drawable backgrounds[] = new Drawable[2]; //getting first image backgrounds[0] =…
5
votes
1 answer

Android TransitionDrawable: image scaletype changes upon fragment resuming

I have an ImageView set as the background for a fragment (the imageview is set to match_parent on both width and height) and the scaletype is set to centerCrop. I download an image to put in there asynchronously and use a TransitionDrawable to…
AndroidNoob
  • 2,653
  • 2
  • 37
  • 51
5
votes
1 answer

TransitionDrawable with nine patches - margin is wrong

I have a TransitionDrawable. The two states are both nine patches and have a content area defined. The problem is the margin is just way too high - in fact it's basically twice as much as it should be. It seems like it's adding up the margins of the…
4
votes
2 answers

CardView doesn't support TransitionDrawable?

I tried to animate a switch-color on CardView background, but I'm getting this: Cannot resolve method 'setCardBackgroundColor(android.graphics.drawable.TransitionDrawable)' If CardView does not support TransitionDrawable, then how can we achieve…
S.R
  • 2,602
  • 2
  • 17
  • 43
4
votes
1 answer

Is there any CircleImageView alternative with TransitionAnimation support?

I have ImageView. After loading bitmap in onPostExecute I call setImageDrawable to fill imageView ( I use CircleImageView) with image. But TransitionDrawable shows only 1st image and no transaction executed. How do I get this working? Thanks in…
AlexKost
  • 1,914
  • 3
  • 13
  • 39
4
votes
4 answers

Transition Drawable with more than 2 layers

Can there be more than 2 items in transition drawable? I need to change background so second frames fades in than on top of it third does and so on to fourth... for now I have this:
Graykos
  • 1,191
  • 3
  • 18
  • 30
3
votes
1 answer

Android UI - How to change images dynamically when using TransitionDrawable

I want to make a transition of some images using TransitionDrawable. However, TransitionDrawable only allows two images. How can I change the images dynamically?
24k_magic
  • 31
  • 4
3
votes
0 answers

Android - Applying TransitionDrawable programmatically - issue

I have trying to change background color when user select different options. For that I am creating TransitionDrawable at runtime. Its works fine. But my Problem is when I change my view background using setDrawableBackground(), Half of my screen…
Prakash M
  • 651
  • 3
  • 13
3
votes
0 answers

TransitionDrawable not changing the color as expected

I have the following in a class ProgressIndicatorView. The view, when used holds the five rectangles below : When the user presses the button "Fortsæt" I call the views method setProgressIndicator(int step) which sets the color of the next rectangle…
CodePrimate
  • 6,426
  • 13
  • 44
  • 85
3
votes
1 answer

Is it possible to use TransitionDrawable on the ActionBar?

I'm trying to do some color animation on the action bar by using a TransitionDrawable. The code I'm trying is pretty simple, during onCreate, I put the transition drawable as the actionbar background: Drawable d =…
Budius
  • 37,587
  • 15
  • 92
  • 134
2
votes
0 answers

Identical drawable items are not rendered the same size with TransitionDrawable

I am trying to animate alternating background colours for a TextView, by changing the background drawables with the TransitionDrawable class. This is the result I am getting: The problem is that the second drawable is smaller than the first one ,…
2
votes
0 answers

How to get a reference to an embedded Drawable?

I have an outer clip drawable (clip_drawable.xml) which embeds another transition drawable (transition_drawable.xml), which itself refers to 2 shape drawables. clip_drawable.xml:
Andy
  • 290
  • 2
  • 13
2
votes
1 answer

Android TransitionDrawable current displayed layer

I have a widget that is using an alarmmanager to make frequent updates (when the phone is awake). Since the update requires hitting a local arduino webserver the update is being done in a service. Based on the results want to set a…
John
  • 5,057
  • 25
  • 31
1
vote
0 answers

TransitionDrawable causing ANR in android

im having an issue with TransitionDrawable class in android causing an ANR in strict mode. Here is the method call causing the ANR: private void crossFadeImages(Drawable imageToFadeOut, Drawable imageToFadeIn) { TransitionDrawable td = new…
j2emanue
  • 51,417
  • 46
  • 239
  • 380
1
2 3