Thursday, 25 August 2011

Drawable Mutations

Android’s drawables are extremely useful to easily build applications.
A Drawable is pluggable drawing container that is usually associated with a 
View. For instance, a BitmapDrawable is used to display images, a ShapeDrawable 
to draw shapes and gradients, etc. You can even combine them to create 
complex renderings.
 
 
Drawable star = context.getResources().getDrawable(R.drawable.star);
if (your specific condition) {
  star.setAlpha(255); // opaque
} else {
  star.setAlpha(70); // translucent
}
 
Here cathodal of specific sea item in the following screen is opaque remaning
are transculacent 
 
drawable_mutations_02
 

No comments:

Post a Comment