I am trying to add an animated spinner inside a EditText view to the right. And programmatically show/hide it.
I have created the animated spinner b
If you are using TextInputLayout and want to animate the drawable look into this
First define the animation set like this way in res/anim/
and in your code set the animation
final Animation animation = AnimationUtils.loadAnimation(this, R.anim.anims);
final ImageView imgLeft = (ImageView) findViewById(R.id.imgLeft);
final EditText et = (EditText) findViewById(R.id.cardnumEditTexst);
et.setOnFocusChangeListener(new View.OnFocusChangeListener()
{
@Override
public void onFocusChange(View v, boolean hasFocus)
{
if (hasFocus)
{
if (et.getText().length() == 0)
{
imgLeft.startAnimation(animation);
}
} else
{
if (et.getText().length() == 0)
imgLeft.clearAnimation();
}
}
});