Even I have the same problem.
I tried to be smart and added an ImageView to fill my parent layout
and tried to set the source of the Imageview using setImageViewResource
(int viewId, int srcId)... but did not the desired results. as my
background drawable was a NinePatch PNG and setting the source of the
ImageView to a .9.png does not scale to fill it. only setting .9.png
to the background of a view scales it properly.
I had to do the same thing as you did.. adding a separate layout for
each background i want..

looks like even google engineers do not know how to it. If you look at
the layout XML file Names(its all compiled xml in the APK so you can't
read whats inside but see the names atleast) for the application
"Scoreboard"(available in the market) by google. you will find two
different layouts named "black" & "white" for the widget.

Please if someone knows a solution to this

On Dec 21 2009, 1:00 pm, Ryan <rgra...@gmail.com> wrote:
> I am having this same issue have you found a solution? My current
> workaround is to make a new XML layout file for each background that I
> want in the imageview. But I can't believe that there isn't a way to
> do this in code. Thanks,
>
> - Ryan
>
> On Dec 9, 2:58 pm, pcm2a <reeeye...@gmail.com> wrote:
>
>
>
> > I have a simple layout:
> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> > android"
> >                 android:background="@drawable/background"
> >         android:layout_height="fill_parent"
> >         android:layout_width="wrap_content"
> >         android:orientation="vertical">
>
> > In my method onUpdate I can get theremoteview:
>
> > RemoteViews remoteView = new RemoteViews(context.getPackageName(),
> > R.layout.somelayout");
>
> > I cannot find any information on how to change or hide thebackground
> > image.
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to