I'm trying to add a tint to an ImageView that I have created in
main.xml, but when that code runs nothing seems to happen. IE, no
tinting occurs.

Here's the XML creating it:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <ImageView
        android:id="@+id/img_main"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="center"
        android:src="@drawable/main" />

</FrameLayout>

Later I deal with it like so:

      ...
      private ImageView imgMain;
      ...

      imgMain = (ImageView) findViewById(R.id.img_main);


And then the call (in a different method) that doesn't work:

      this.imgMain.setColorFilter(0xFF0000, PorterDuff.Mode.SRC_ATOP);

I put a Toast popup after it so that I could verify that setColorFilter
() was running, and it was. I've scoured the ImageView documentation
for some sort of "make it so" method -- I've tried requestLayout(),
forceLayout(), and refreshDrawableState() -- but they all just sit
there like bumps on a log and don't appear to do anything. Every time
my Toast sadly pops up and my background image isn't tinted at all. =
( What am I missing?

Thanks!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to