I created a custom shape from XML that's a simple small oval.  I want to 
change the color of the oval at runtime to be either red or blue.  Here's 
the relevant code:

shape definition from favorite_team_line.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"; 
type="oval">

    <solid android:color="#FFFFFFFF" />
    <corners android:radius="2dp" />
</shape>

Style definition from styles.xml:
    <style name="teamListLine">
        <item name="android:layout_height">40dip</item>
        <item name="android:layout_width">5dip</item>
        <item name="android:layout_marginTop">3dip</item> 
        <item name="android:layout_marginBottom">5dip</item>
    </style>

Layout definition in main.xml:
<?xml  version="1.0"  encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android";
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:padding="30dip"
android:layout_gravity="center">

    <ImageView style="@style/teamListLine"
        android:id="@+id/main_line"
        android:src="@drawable/favorite_team_line" />
....
</LinearLayout>

And finally, the code where the layout is used:
public class MyClass extends UpdateActivity implements OnClickListener {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState, R.layout.main);

        ImageView line = (ImageView)findViewById(R.id.main_line);
     line.setColorFilter(new LightingColorFilter(0xFF0000FF, 0));

    ....
    }
    ....
}

When I run the above code on 2.1-update1, I see the blue oval.  When I run 
it on 2.2 or 2.3, the oval is no longer visible.  If I remove the call to 
setColorFilter(), I see a white oval on all 3 platforms.  What could I be 
doing wrong?  Is there a way to change the color of the shape other than 
setColorFilter?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en

Reply via email to