<?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"><!--define the first table layout, specify that the 2nd column is allowed to shrink, and the 3rd column allows stretching--><tablelayout android:id="@+id/tablelayout01"Android:layout_width="fill_parent"Android:layout_height="wrap_content"Android:shrinkcolumns="1"Android:stretchcolumns="2"> <!--directly add a button, it will take up one line--<button android:id="@+id/ok1"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="buttons on a single line"/> <!--Add a table row--<TableRow> <!--add 3 buttons to the table row--<button android:id="@+id/ok2"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="Normal button"/> <button android:id="@+id/ok3"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="allow the button to be shrunk"/> <button android:id="@+id/ok4"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="Allow stretched buttons"/> </TableRow> </TableLayout><!--define the second table layout and specify the second column to hide--><tablelayout android:id="@+id/tablelayout01"Android:layout_width="fill_parent"Android:layout_height="wrap_content"Android:collapsecolumns="1"><!--Add a button directly, it will take up a line--><button android:id="@+id/ok5"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="buttons on a single line"/><!--Define a table row--><tablerow><!--add 3 buttons to the table row--><button android:id="@+id/ok6"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="Normal button 1"/> <button android:id="@+id/ok7"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="the button that is hidden"/> <button android:id="@+id/ok8"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="Normal button 3"/></tablerow> </TableLayout><!--Define a third table layout, specifying that 2nd, 32 columns can be stretched--><tablelayout android:id="@+id/tablelayout01"Android:layout_width="fill_parent"Android:layout_height="wrap_content"Android:stretchcolumns=" the"><!--Add a button directly, it will take up a line--><button android:id="@+id/ok9"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="buttons on a single line"/><!--Define a table row--><tablerow><!--add 3 buttons to the table row--><button android:id="@+id/ok10"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="Normal button"/> <button android:id="@+id/ok11"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="Allow stretched buttons"/> <button android:id="@+id/ok12"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="Allow stretched buttons"/></tablerow> <!--define a table row--><tablerow><!--add 2 buttons to the table row--><button android:id="@+id/ok13"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="Normal button"/> <button android:id="@+id/ok14"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="Allow stretched buttons"/></tablerow> </TableLayout></LinearLayout>