2

I have two images which I want to fade between causing a glowing on and off effect. This should run all the time like an animation, not just when the button is pressed.

Here are the two images: enter image description here

enter image description here

This was working well before but after some hardware/android OS updates my animation is really jumpy. Here is the Animation XML I was using:

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:drawable="@drawable/bottom_bar_add_dark"/>
    <item android:drawable="@drawable/bottom_bar_add" android:duration="500" />
</animation-list>

I have looked high and low and cannot find an answer to this.

Edit

Here is the code that creates the image view and sets all its resources:

public ImageView findDevicesButton(){
        bottomButton = new ImageView(this);
        int id = bottomButton.generateViewId();
        bottomButton.setId(id);
        if(currentapiVersion >= 11){

            bottomButton.setImageResource(R.drawable.animationxmladddevice);
            //Background image
            bottomButton.setBackgroundResource(R.drawable.bottom_bar);

            saveButtonAnimation = (AnimationDrawable)bottomButton.getDrawable();
            saveButtonAnimation.setEnterFadeDuration(1000);
            saveButtonAnimation.setExitFadeDuration(1000);
            bottomButton.setOnClickListener(new OnClickListener(){

                public void onClick(View v) {
                    findDevicesAlertBuilder();

                }

            });
        }else{
            bottomButton.setImageResource(R.drawable.bottom_bar_add);
            bottomButton.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
            bottomButton.setBackgroundResource(R.drawable.bottom_bar);

            bottomButton.setOnClickListener(new OnClickListener(){

                public void onClick(View v) {
                    findDevicesAlertBuilder();

                }

            });

        }


        return bottomButton;
    }

This is the back background image: enter image description here

All together it should look like this with the center button glowing: enter image description here

Travis Elliott
  • 291
  • 2
  • 5
  • 18
  • use drawable selector and assign as background – amodkanthe May 08 '15 at 16:39
  • Thank you @apk I am already using an image that needs to be static for the background. Is there a difference in animation whether you are using image source or image background? – Travis Elliott May 08 '15 at 16:59
  • in selector for background use two images on selected keep bg glow otherwise keep it simple one. Same goes for text use drawable selector change color of font on click that what I can suggest not sure how it can be achieved by animation – amodkanthe May 08 '15 at 17:04
  • @apk Please see edit in question. Maybe this helps to more fully explain the question – Travis Elliott May 08 '15 at 17:19

0 Answers0