[android-developers] Re: include/ in TableRow

2009-05-13 Thread matthias

I have the same problem with including an EditText into a
RelativeLayout. All layout parameters are ignored, or at least not
recognized properly. The width/height fix doesn't work for me,
because the included view must not have fixed width or height.

The included view:

?xml version=1.0 encoding=UTF-8?
EditText xmlns:android=http://schemas.android.com/apk/res/android;
android:id=@+id/location_field
android:layout_width=wrap_content
android:layout_height=wrap_content
android:singleLine=true
android:paddingLeft=10sp
android:paddingRight=10sp
android:layout_centerVertical=false
android:layout_centerHorizontal=true
android:inputType=text
android:imeOptions=actionDone|flagNoEnterAction
/

And the layout where I include it:

?xml version=1.0 encoding=utf-8?
RelativeLayout
xmlns:android=http://schemas.android.com/apk/res/android;
android:layout_width=fill_parent
android:layout_height=fill_parent
android:background=@android:color/transparent

...

LinearLayout android:id=@+id/search_linear_layout_1
android:layout_below=@id/search_title_image
android:layout_height=wrap_content
android:layout_width=fill_parent

...

/LinearLayout

include layout=@layout/location_field
android:id=@+id/search_edit_text
android:layout_width=300px
android:layout_below=@id/search_linear_layout_1
/

LinearLayout android:id=@+id/search_linear_layout_2
android:layout_below=@id/search_edit_text
android:layout_height=wrap_content
android:layout_width=fill_parent

...

/LinearLayout

...

/RelativeLayout

The edit box floats at the top of the screen instead of below the
linear layout, and is also not 300 pixels wide.

Any ideas?

Thanks,
Matthias
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: include/ in TableRow

2009-05-13 Thread matthias

Correction:
Passing the layout_* params to include works, but you MUST provide
them there, not in the included view. If you pre-define them in the
included view, then they get ignored, so there is no point in defining
defaults and only overriding the ones you need to change; you always
have to pass all layout attributes in the include directive. :-/

Is this a bug?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: include/ in TableRow

2009-05-11 Thread longhairedsi

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: 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:x 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
-~--~~~~--~~--~--~---