Set the layout weight of a TextView programmatically

I’m trying to dynamically create TableRow objects and add them to a TableLayout. The TableRow objects has 2 items, a TextView and a CheckBox. The TextView items need to have their layout weight set to 1 to push the CheckBox items to the far right. I can’t find documentation on how to programmatically set the … Read more

Linear Layout and weight in Android

I always read about this funny weight value in the Android documentations. Now I want to try it for the first time but it isn’t working at all. As I understand it from the documentations this layout: <LinearLayout android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:orientation=”horizontal”> <Button android:text=”Register” android:id=”@+id/register” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:padding=”10dip” weight=”1″ /> <Button android:text=”Not this time” android:id=”@+id/cancel” android:layout_width=”wrap_content” … Read more