[Androrid]笔记9-用户友好的输入界面

对于一个用户友好的输入界面而言,接受用户输入的文本框内默认会提示用户如何输入;当前用户把焦点切换到输入框时,输入框自动选中其中已输入的内容,避免用户删除已有内容;当用户把焦点切换到只接受电话号码时,输入法自动切换到键盘

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:androrid="http://schemas.android.com/apk/res/android"
    androrid:layout_width="match_parent"
    androrid:layout_height="match_parent"
    androrid:stretchColumns="1"
    >
    <TableRow>
    <TextView
        androrid:layout_width="match_parent"
        androrid:layout_height="wrap_content"
        androrid:text="用户名"
        androrid:textSize="16sp"
        />
        <EditText
            androrid:layout_width="match_parent"
            androrid:layout_height="wrap_content"
            androrid:hint="请填写登录账号"
            androrid:selectAllOnFocus="true"
            />
    </TableRow>
    <TableRow>
        <TextView
            androrid:layout_width="match_parent"
            androrid:layout_height="wrap_content"
            androrid:text="密码"
            androrid:textSize="16sp"
            />
        <!--只能接受数字密码-->
        <EditText
            androrid:layout_width="match_parent"
            androrid:layout_height="wrap_content"
            androrid:inputType="numberPassword"
            />
    </TableRow>
    <TableRow>
        <TextView
            androrid:layout_width="match_parent"
            androrid:layout_height="wrap_content"
            androrid:text="年龄"
            androrid:textSize="16sp"
            />
        <!--inputType="number"表明只能输入数值-->
        <EditText
            androrid:layout_width="match_parent"
            androrid:layout_height="wrap_content"
            androrid:inputType="number"
            />
    </TableRow>
    <TableRow>
        <TextView
            androrid:layout_width="match_parent"
            androrid:layout_height="wrap_content"
            androrid:text="生日"
            androrid:textSize="16sp"
            />
        <!--inputType="date"表明日期输入框-->
        <EditText
            androrid:layout_width="match_parent"
            androrid:layout_height="wrap_content"
            androrid:inputType="date"
            />
    </TableRow>
    <TableRow>
        <TextView
            androrid:layout_width="match_parent"
            androrid:layout_height="wrap_content"
            androrid:hint="请填写您的电话号码"
            androrid:text="电话号码"
            androrid:textSize="16sp"
            />
        <!--inputType="phone"表明只能输入数值-->
        <EditText
            androrid:layout_width="match_parent"
            androrid:layout_height="wrap_content"
            androrid:selectAllOnFocus="true"
            androrid:inputType="phone"
            />
    </TableRow>
    <Button
        androrid:layout_width="wrap_content"
        androrid:layout_height="wrap_content"
        androrid:text="注册"
        />
</TableLayout>

这里写图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

厦门德仔

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值