XML : Why won't this change the color?

I asked a question before on how I can change the color of the default android drawable star into yellow, rather than white, and I got an answer to do this:

   Drawable drawable = getResources().getDrawable(android.R.drawable.btn_star);          drawable.setColorFilter(Color.YELLOW, PorterDuff.Mode.SRC_ATOP);    

Here is my star:

      android:onClick = "star"      android:layout_width="100dp"      android:layout_height="100dp"      android:layout_alignParentTop="true"      android:background="@android:drawable/btn_star"    

/>

But, the star is still white (Image below) Why wasn't the setColorFilter working? The star's edges turn yellow when I click on it... How can I keep the star yellow using the android's provided star drawable?

enter image description here

No comments:

Post a Comment