Ok, I found a solution but I'm still not sure why this doesn't work.

I had to use within the included view

android:height="100dp"
android:width="50dp"

instead of

android:layout_height="100dp"
android:layout_width="50dp"

cheers
simon

On May 6, 10:56 pm, longhairedsi <longhaire...@googlemail.com> wrote:
> Hi,
>
> I have a problem trying use <include /> within a table row. Any
> android:xxxx atributes applied to the widget within the include are
> ignored. Here's is a test I put together. The two buttons outside the
> table layout render correctly(adjusted width and height), the one's
> inside do not. Strangely, the custom TwoStateButton:xxxxx attributes
> are rendered correctly in both cases.
>
> ---------- main.xml --------
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>     android:orientation="vertical"
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent"
>     >
>     <include android:id="@+id/btn1" layout="@layout/custom_button" />
>     <include android:id="@+id/btn2" layout="@layout/button_type2" />
>         <TableLayout
>                 android:layout_width="wrap_content"
>                 android:layout_height="wrap_content"
>         >
>                 <TableRow>
>                         <include android:id="@+id/btn3" 
> layout="@layout/custom_button" />
>                         <include android:id="@+id/btn4" 
> layout="@layout/button_type2" />
>                 </TableRow>
>         </TableLayout>
> </LinearLayout>
>
> ------- custom_button.xml -----------
> <?xml version="1.0" encoding="utf-8"?>
> <com.basementajax.tests.TwoStateButton
>         xmlns:android="http://schemas.android.com/apk/res/android";
>         xmlns:TwoStateButton="http://schemas.android.com/apk/res/
> com.basementajax.tests"
>                 android:layout_height="100dp"
>                 android:layout_width="50dp"
>                 TwoStateButton:onText="This is on"
>         TwoStateButton:offText="Off"
>         TwoStateButton:onBgId="@drawable/btn_red"
>         TwoStateButton:offBgId="@drawable/btn_red"
>         />
>
> <?xml version="1.0" encoding="utf-8"?>
>
> -------- button_type2.xml ---------
> <ToggleButton
>         xmlns:android="http://schemas.android.com/apk/res/android";
>         android:layout_height="100dp"
>         android:layout_width="50dp"
> />
>
> Can anyone shed any light on this? why will the buttons not render
> correctly in the TableRow, have i missed something?
>
> Many thanks
> Simon
--~--~---------~--~----~------------~-------~--~----~
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