1. Are you ready for the Galaxy S20? Here is everything we know so far!

Change Widget Background from Code

Discussion in 'Android Development' started by Matt M, May 16, 2010.

  1. Matt M

    Matt M Lurker
    Thread Starter

    Hello,

    I am trying to allow the user to change the widget background color (black, white, transparent). Instead of adding numerous xml files each linking to a different background image, is there anyway I can go about changing the widget background image through code? For example, using LinearLayout

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/widget"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android;orientation="vertical"
    style="@style/WidgetBackground2x2">

    Is there any way I can set the "style" attribute from the code? I know this method does not exist but something along these lines:
    LinearLayout.setStyle(R.style.WidgetBackground2x2_transparent);

    Thank you!

    Matt.
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...
Similar Threads - Change Widget Background
  1. HotspotSwitchIp
    Replies:
    1
    Views:
    478
  2. dj_nick_t
    Replies:
    2
    Views:
    478
  3. Biffos
    Replies:
    10
    Views:
    569
  4. writerman
    Replies:
    3
    Views:
    632
  5. stuarta
    Replies:
    3
    Views:
    481
  6. Sunny Rio
    Replies:
    18
    Views:
    894
  7. Alex Ethridge
    Replies:
    9
    Views:
    829
  8. RedHeadDev
    Replies:
    4
    Views:
    916
  9. Sunny Rio
    Replies:
    9
    Views:
    1,243
  10. Madd63
    Replies:
    14
    Views:
    656

Share This Page

Loading...