Setting transparency for a view in android 2.x version is not as easy as calling 1 method, but it still is pretty a trivial task:
final AlphaAnimation alphaAnimation = new AlphaAnimation(0.5F, 0.5F); // Creating new alpha animation, that makes the view half transparentalphaAnimation.setDuration(0); // Make animation to perform instantlyalphaAnimation.setFillAfter(true); // Persist changes after the animation ends
yourLayout.startAnimation(alphaAnimation); // Call it for any view
As easy as that :)
final Animation animation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisibleanimation.setDuration(250); // duration 250 millisecondsanimation.setInterpolator(new LinearInterpolator()); // do not alter animation rateanimation.setRepeatCount(Animation.INFINITE); // Repeat animation infinitelyanimation.setRepeatMode(Animation.REVERSE); // Reverse animation at the end so the button will fade back infinal Button btn = (Button) findViewById(R.id.your_btn); // Your buttonbtn.startAnimation(animation);btn.setOnClickListener(new OnClickListener() { @Override public void onClick(final View view) { // Some of your code on click view.clearAnimation() }});It's not limited for button only, you can se virtually for any view.