[:zh]<界面编程>任务二 用户注册界面设计[:]

0 424

[:zh]

(1)EditText控件详解

编辑框使用EditText表示,作用是在屏幕上显示文本输入框。编辑框可以输入单行文本,也可以输入多行文本,还可以指定是的文本(如密码、电话号码、日期等)。编辑框的基本语法格式如下。

<EditText

        属性列表

/>
XML属 性                                                                                     说明
  android: hint 为空时显示的文字提示信息,可通过textColorHint设置提示信息的颜色
android:inputType 设置文本的类型,用于帮助输入法显示合适的键盘类型。有如下值设置:none、text、textCapCharacters字母大小、textCapWords单词首字母大小、textAutoComplete自动完成、phone电话号码、datetime时间日期、date日期、time时间等
android:password 以小点.显示文本
android:phoneNumber 设置为电话号码的输入方式

(2)文字填空题(1 分)

//在空白处填入适当代码,使编辑框为空时默认显示“Hello World”。

<EditText

        android_layout_width="fill_parent"

        android_layout_height="wrap_content"

        android_textColor="#DDDDDD"

        _________________

        android:id ="@+id/et"

        android:maxLength = "10"

/ ></EditText/ >            ANSWER:android:hint="Hello World"

(3)Button按钮用法

按钮使用Button表示,作用是在屏幕上显示一个按钮。按钮的基本语法格式如下。

<Button

        属性列表

/>

(4)文字填空题(1 分)

在空白处填入适当代码,使按钮显示文字“点击”。

<Button

        android_layout_width="fill_parent"

        android_layout_height="wrap_content"

        ______________

></Button>       ANSWER:android:text="点击"

(5)实战代码、视频、截图

5.1界面编程实战1:实战视频

5.2相应XMl代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns_android="http://schemas.android.com/apk/res/android"
    android_orientation="vertical" android_layout_width="match_parent"
    android_layout_height="match_parent">

    <LinearLayout
    android_layout_width="match_parent"
    android_layout_height="wrap_content"
        android_gravity="center_horizontal"
        android_orientation="vertical">

        <TextView
            android_layout_width="match_parent"
            android_layout_height="wrap_content"
            android_text="注册新用户"
            android_gravity="center_horizontal"
            android_textSize="12pt"
            android_textStyle="bold"
            />
    </LinearLayout>

    <TextView
        android_layout_width="wrap_content"
        android_layout_height="wrap_content"
        android_text="用户名:"
        android_textSize="10pt"/>
    <EditText
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_hint="请填写登陆账号"
        android_selectAllOnFocus="true"
        android_id="@+id/editText" />

    <TextView
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_text="密码:"
        android_textSize="10pt"
        />
    <EditText
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_password="true"
        />

    <TextView
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_text="电话号码:"
        android_textSize="10pt"
        />
    <EditText
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_hint="请填写您的电话号码"
        android_phoneNumber="true"
        android_selectAllOnFocus="true"
        />

    <TextView
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_text="出生日期:"
        android_textSize="10pt"
        />
    <EditText
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_hint="请填写你的出生日期"
        android_inputType="date"
        android_selectAllOnFocus="true"
        />

    <LinearLayout
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_gravity="center_horizontal">

        <Button
            android_layout_width="wrap_content"
            android_layout_height="wrap_content"
            android_text="注 册"
            />
    </LinearLayout>
</LinearLayout>

<!--author CYJ 2018-01-22 -->

(6)源码链接

往期链接:<Android界面编程>  任务一   酱油诗词赏析 

[:]

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

声明:本站所有文章资源,如无特殊说明或标注,均为本站网友和创作者贡献分享。如若本站内容侵犯了原著者的合法权益,可联系网站客服QQ2743319061删除。

云炬星球 云炬随笔 [:zh]<界面编程>任务二 用户注册界面设计[:] https://src.yunjunet.cn/1713515.html

常见问题
  • 放心亲,我们不会为了几十块钱的东西坏了名声!
查看详情
  • 方法一:点击“立即下载.”按钮,付款后在下载弹窗的虚线框的隐藏信息里获取 方法二:在正文底部使用VIP查看隐藏的解压密码 方法三:联系【云炬网络】公众号客服获取
查看详情
  • 付款后会出现“立即下载”按钮(点击即可下载),如果下载失败也可以联系客服发订单截图补发。
查看详情
  • 登录购买会多端同步购买记录,永久可以查看反复下载;非登录购买仅将购买记录保存到本地浏览器中,浏览器cookie清除后无法再次下载。先右上角点登录,然后点击微信图标可以快速授权注册登录^_^
查看详情
  • 可以试看。点击”查看演示“或“试看预览”按钮可以试读从资料目录中节选的部分内容,也可以自己指定想试看的内容。
查看详情
  • 原因一:本站所有资源已开启有效性检测(服务器24h全自动监测),当监测到下载链接无法访问时会提示“该资源已失效,请勿购买”,遇到这种情况可以联系客服修复失效的下载链接,或直接联系客服在淘宝下单购买即可。(检测原理:购买前服务器程序会预访问下载链接,响应值为200说明资源有效允许购买,响应值为404或502等报错说明资源失效禁止购买)。原因二:上传者未启用“下载”选项。
查看详情
官方客服团队

为您解决烦忧 - 24小时在线 专业服务