Hi

I want to change the color of a shape dynamically but I am unsure how.



<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android";
   android:shape="rectangle">
    <solid
       android:color="#FFFF00" />
    <padding android:left="7dp"
        android:top="7dp"
        android:right="7dp"
        android:bottom="7dp" />
</shape>

<TextView
    android:background="@drawable/test"
    android:layout_height="45dp"
    android:layout_width="100dp"
    android:text="Moderate"
/>



// this seems to be how do it in android
ShapeDrawable bgShape = (ShapeDrawable )btn.getBackground();
bgShape.getPaint().setColor(Color.BLACK);


I tried

    ShapeDrawable bgShape = (ShapeDrawable)
Resources.GetDrawable(Resource.Drawable.danger_box);
            bgShape.Paint.Color = Resource.Color.test;

but it crashes on the first line(does not really seem to give a error).

--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/How-to-change-shapes-color-dynamically-tp4728020p4728020.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to