1

I would like to change the alpha programmatically value of my image view inside my remote view but it has no effect at all.

how i assign it:

v.setInt(vR.id.imageView, "setAlpha", alpha);

how i declare it:

<ImageView
      android:id="@+id/widget_agenda_bg_dark"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_margin="5dip"
      android:src ="@drawable/background"
      android:scaleType="fitXY"/>

the ressource bg is a shape:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
     <stroke android:width="0dp" android:color="#FFFFFFFF" />
     <gradient android:startColor="#FF000000" android:endColor="#FF7A7A7A"
            android:angle="315"/>

    <corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp"
     android:topLeftRadius="7dp" android:topRightRadius="7dp"/>
</shape> 

everything got diplayed correctly and doesnt throw any error, but still it dont changes the alpha value ... Any idea?

Anthea
  • 3,741
  • 5
  • 40
  • 64

1 Answers1

0

I don't know about the setInt method, but you're using android:startColor="#FF000000" in you gradient where the first two letters "FF" are for the opacity and the six others define the hex color.

If you declare android:startColor="#00000000" your startColor will be completely invisible and something like android:startColor="#80000000" will be a little transparent.

Tom
  • 305
  • 5
  • 24
  • thanks for your answer. I didn't specify my question enough. I would like to change the alpha value programmatically. – Anthea Feb 15 '12 at 08:48