I have a remote view (I.e. I am using a widget), and I want to change
the background programaticaly. Basically the background is s shape
with rounded corners and I simply want to change the colour. I can
change the colour using the code below
views.setInt(R.id.stats_w_name, "setBackgroundColor",
android.graphics.Color.GREEN);

but really I want to set the background to a drawable I create at
runtime (rather than from a resource file. There doesn't seem to be a
method available to do this, any ideas?

Widget layout shown below for reference, the bit I want to change the
background of is stats_w_name.

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android";
  android:orientation="vertical" android:layout_height="72dp"
android:layout_width="146dp">
    <TextView android:layout_width="fill_parent"
android:gravity="center" android:background="@drawable/box1"
android:id="@+id/stats_w_name" android:text="Error"
android:layout_height="23dp"></TextView>
    <TextView android:layout_width="fill_parent" android:id="@+id/
stats_w_value" android:layout_height="34dp" android:gravity="center"
android:text="1234567.00" android:textSize="28sp"
android:background="@drawable/widget_figure_background"
android:textColor="#000000"></TextView>
    <TextView android:layout_width="fill_parent"
android:text="1/1/2000" android:gravity="center" android:id="@+id/
stats_w_time" android:layout_height="20dp" android:textSize="10sp"
android:background="@drawable/bottom_box"></TextView>

</LinearLayout>

-- 
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