changing layout background from XmlResourceParser for widgets

by Abdul Mateen » Wed, 09 Dec 2009 19:49:37 GMT


Sponsored Links
 Hi,
I have an app widget, I want to change the background drawable of
LinearLayout while in runtime, how can I do that? I have tried using
XmlResourceParser
as
XmlResourceParser p = getResources().getLayout(R.layout.main);
p.next();
p.nextToken();

it takes me to linearlayout but when I issue
p.getProperty("background"); it returns null? what should I use instead of
background here? or is there any other way to change wiget's background at
runtime.

Thank You,
Abdul Mateen.

--



Other Threads

1. Tampang suhu-suhi mirink & x10 launching

sended by Motorola Milestone with Android OS & xL unlimited.

-- 
"Indonesian Android Community [id-android]" 

2. Top of form is hidden under the Application name

Ok...its a minor problem.    My activity uses "wrap_content" and it
centes, so it sizes as needed.  The problem is that when I put 10
EditText boxes on the screen, the top two are off screen top side, and
you cant scroll to them.  I can scroll to the bottom with no
problems.  I added a padding on the top to get data to show, but the
window is still off the top.

I can live with my fix, but would like to know how to  correct the
problem. The window should have a little margin around all sides.  It
works fine if I have less data.  And, if I type enough data into an
EditBox, it expands to fill the window as expected.  I tried setting
margins, but that didnt work.

Hers is my stat code for the view.. the myShape file just sets the
corners
*****************************************************************
<ScrollView
  android:id                     ="@+id/ScrollView01"
  android:layout_width    = "wrap_content"
  android:layout_height   = "wrap_content"
  android:layout_gravity  = "center"
  android:scrollbars       = "none"
  xmlns:android   = "http://schemas.android.com/apk/res/android" >
  <RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
        android:id              ="@+id/ItemViewID"
        android:orientation     ="horizontal"
        android:layout_width    ="wrap_content"
        android:layout_height   ="wrap_content"
        android:layout_gravity  ="center"
        android:background      ="@drawable/myshape"
        android:paddingLeft     ="5dp"
      android:paddingRight      ="5dp"
      android:paddingTop        ="625dp"
      android:paddingBottom     ="5dp"
 >

-- 

3. Double click on app widget

4. Change the playback rate of a track in real time

5. Tanya app push mail untuk account mail.yahoo.com

6. Official Twitter App for Android 2.1 and above

7. Blapk Marke