> So I'm attempting to make a widget at someone's request.  I'm new to
> Android development, so this widget isn't terribly complex.  However,
> I'm having some difficulties with the layout.  My main.xml file looks
> like this:
>
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout android:id="@+id/LinearLayout01"
>       xmlns:android="http://schemas.android.com/apk/res/android";
>       android:background="@drawable/widgetframe"
>       android:layout_height="wrap_content"
>       android:layout_width="wrap_content"
>       android:layout_gravity="center">
>       <TableLayout android:id="@+id/TableLayout01"
>               android:layout_width="fill_parent"
>               android:stretchColumns="0,1,2"
>               android:layout_marginTop="20dip"
>               android:layout_marginBottom="20dip"
>               android:layout_marginLeft="25dip"
>               android:layout_marginRight="25dip"
>               android:layout_gravity="center_vertical"
>               android:layout_height="wrap_content">
>               <TableRow android:id="@+id/TableRow01"
>                       android:layout_width="fill_parent"
>                       android:layout_height="fill_parent"
>                       android:layout_gravity="center_vertical">
>                       <Button android:text="0"
>                               android:id="@+id/Button01"
>                               android:layout_width="wrap_content"
>                               android:layout_height="wrap_content"
> android:layout_gravity="center_vertical"></Button>
>                       <Button android:text="0"
>                               android:id="@+id/Button02"
>                               android:layout_width="wrap_content"
>                               android:layout_height="wrap_content"
> android:layout_gravity="center_vertical"></Button>
>                       <Button android:text="0"
>                               android:id="@+id/Button03"
>                               android:layout_width="wrap_content"
>                               android:layout_height="wrap_content"
> android:layout_gravity="center_vertical"></Button></TableRow>
>                       <TableRow android:id="@+id/TableRow02"
>                               android:layout_gravity="center_horizontal"
>                               android:layout_width="fill_parent"
>                               android:layout_height="wrap_content" >
>                               <TextView android:text="Missed Calls"
>                                       android:id="@+id/TextView01"
>                                       android:layout_width="wrap_content"
>                                       android:layout_height="wrap_content"
>                                       
> android:layout_gravity="center_horizontal"></TextView>
>                               <TextView android:text="Messages"
>                                       android:id="@+id/TextView02"
>                                       android:layout_width="wrap_content"
>                                       android:layout_height="wrap_content"
>                                       
> android:layout_gravity="center_horizontal"></TextView>
>                               <TextView android:text="New Emails"
>                                       android:id="@+id/TextView03"
>                                       android:layout_width="wrap_content"
>                                       android:layout_height="wrap_content"
>                                       
> android:layout_gravity="center_horizontal"></TextView>
>                       </TableRow>
>       </TableLayout>
> </LinearLayout>
>
> So it's a layout of two rows, the first row consisting of three
> buttons and the second row consisting of three TextViews.  When I try
> to test the widget, however, I get a widget with the words "Problem
> loading widget" on my AVD.  Is there an issue with my XML, or is it
> something else?  I am writing this widget using Android v2.0, SDK 5.
> Thank you for your help.

TableLayout and TableRow are not valid layouts for an app widget. Use
LinearLayout, RelativeLayout, and FrameLayout.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


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