xml vs java LinearLayout fills

Posted by user293443 on Stack Overflow See other posts from Stack Overflow or by user293443
Published on 2010-03-14T16:31:16Z Indexed on 2010/03/14 16:35 UTC
Read the original article Hit count: 299

Filed under:
|
|
|

the xml version below properly handles height and width and the java doesn't what is the java missing?

xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="fill_parent" android:layout_width="fill_parent"
    android:orientation="horizontal">
    <include android:id="@+id/cell1" layout="@layout/grid_text_view" />
    <include android:id="@+id/cell2" layout="@layout/grid_text_view" />
</LinearLayout>

java

LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.HORIZONTAL);
ll.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
ll.addView((TextView)this.getLayoutInflater().inflate(R.layout.grid_text_view, null));
ll.addView((TextView)this.getLayoutInflater().inflate(R.layout.grid_text_view, null));
setContentView(ll);

grid_text_view

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_height="fill_parent"
  android:layout_width="0dip"
  android:text="1"
  android:textSize="20sp"
  android:gravity="center"
  android:layout_weight="1" />

I've tried a ll.invalidate() and it didn't work either? :(

screenshots at http://www.flickr.com/photos/48409507@N06/sets/72157623618407586/

© Stack Overflow or respective owner

Related posts about android

Related posts about Xml