import android.app.Activity;
import android.os.Bundle;
/**
* 表格布局
* @author Administrator
*
*/
public class Layout3 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.setContentView(R.layout.layout3);
//this.setContentView(R.layout.layout4);
//this.setContentView(R.layout.layout5);
}
}
<?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" > <TableLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <TableRow> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="用户名 :" ></TextView> <EditText android:layout_width="50px" android:layout_height="50px" ></EditText> </TableRow> <TableRow> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="用户密码:" ></TextView> <EditText android:layout_width="50px" android:layout_height="50px" android:password="true" ></EditText> </TableRow> </TableLayout> </LinearLayout>
效果: