Android-------模拟用户登录界面(2)

本节讲解登陆界面的实现。

使用LinearLayout整体布局,然后使用TableLayout进行局部布局,,每一行的布局使用TableRow。

具体有  用户名:<TableLayout 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center">
        
        <TableRow 
            android:layout_height="wrap_content"
            android:gravity="center">
            
            <TextView 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="用户名"/>
            
            <EditText 
                android:id="@+id/username"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:hint="请输入用户名"/>"
        </TableRow>

<!--   -->

密码:

 <EditText 
                android:id="@+id/password"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/corner"
                android:hint="请输入密码"
                android:inputType="textPassword"/>
//这里使用textPassword可以隐藏字符


这里是一个单选框:使用RadioGroup.RadioButton

<TextView 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="性别"/>
            <RadioGroup 
                android:id="@+id/sex"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal">
                <RadioButton 
                    android:id="@+id/male"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                   
                    android:checked="true"//首先选中的按键
                    android:text="男"/><!-- 检查时候被选中 -->
                    <TextView 
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="     "/>//进行间隔

                <RadioButton 
                    android:id="@+id/famle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                  
                    android:text="女"/>"
            </RadioGroup>

Spinner控件 获取列表控件的

 <Spinner
                android:id="@+id/from" 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                />


邮件控件

<TableRow 
            android:layout_height="wrap_content"
            android:gravity="center">
            <TextView 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="邮箱地址"/>
            <EditText 
                android:id="@+id/email"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                 android:background="@drawable/corner"
                android:inputType="textEmailAddress"/>"//这里注意

//它会在填写时候只显示英文,如图
        </TableRow>


ToggleButton控件的使用:true/false

<TableRow 
            android:layout_height="wrap_content"
            android:gravity="center">
            <TextView 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="邮箱通知"/>
            <FrameLayout 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
                <ToggleButton 
                    android:id="@+id/notify"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="ToggleButton"/>"
            </FrameLayout><!-- 叠加的方式http://www.cnblogs.com/zhangs1986/archive/2013/01/17/2864899.html -->

//frameLayout布局是叠加使用,最先调用的放在最下面

        </TableRow>



CheckBox控件的使用

<TableRow 
            android:layout_height="wrap_content"
            android:gravity="center">
            <CheckBox 
                android:id="@+id/check"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="同意条款"/>
            <!-- http://www.cnblogs.com/wt616/archive/2011/06/20/2085368.html -->





  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值