andriod_第二天_表格布局

来源:互联网 发布:企业邮箱 端口 编辑:程序博客网 时间:2024/06/07 03:04

TableLayout(相对布局)

:layout/activity_main.xml


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
   >


    <TableLayout 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:stretchColumns="1">
        <TableRow>
            <TextView 
                android:text="用户名:"
                />
            <EditText 
                android:hint="请输入1-10个字符"/>
            
        </TableRow>
        <TableRow>
            <TextView 
                android:text="密   码:"
                />
            <EditText 
                android:hint="请输入1-10个字符"/>
            
        </TableRow>
    </TableLayout>
    <TableLayout 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:stretchColumns="0,1">
        <TableRow>
            <Button 
                android:text="登陆"
                android:background="@drawable/btn_bg"
                android:textColor="#FFF"
                android:drawableLeft="@drawable/login32x32"
                android:layout_gravity="center_horizontal"
                />
            <Button 
                android:text="退出"
                android:background="@drawable/btn_bg"
                android:textColor="#FFF"
                android:drawableLeft="@drawable/exit32x32"
                android:layout_gravity="center_horizontal"
                />
        </TableRow>
    </TableLayout>

</LinearLayout>

效果:




0 0
原创粉丝点击