[:zh]<界面编程>任务二 用户注册界面设计[:]2018-01-24
生活随笔
收集整理的這篇文章主要介紹了
[:zh]<界面编程>任务二 用户注册界面设计[:]2018-01-24
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
(1)EditText控件詳解
編輯框使用EditText表示,作用是在屏幕上顯示文本輸入框。編輯框可以輸入單行文本,也可以輸入多行文本,還可以指定是的文本(如密碼、電話號(hào)碼、日期等)。編輯框的基本語(yǔ)法格式如下。
<EditText屬性列表/>| XML屬 性 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | 說(shuō)明 |
| ? android: hint | 為空時(shí)顯示的文字提示信息,可通過(guò)textColorHint設(shè)置提示信息的顏色 |
| android:inputType | 設(shè)置文本的類型,用于幫助輸入法顯示合適的鍵盤類型。有如下值設(shè)置:none、text、textCapCharacters字母大小、textCapWords單詞首字母大小、textAutoComplete自動(dòng)完成、phone電話號(hào)碼、datetime時(shí)間日期、date日期、time時(shí)間等 |
| android:password | 以小點(diǎn).顯示文本 |
| android:phoneNumber | 設(shè)置為電話號(hào)碼的輸入方式 |
(2)文字填空題(1 分)
//在空白處填入適當(dāng)代碼,使編輯框?yàn)榭諘r(shí)默認(rèn)顯示“Hello World”。<EditTextandroid: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表示,作用是在屏幕上顯示一個(gè)按鈕。按鈕的基本語(yǔ)法格式如下。
<Button
????????屬性列表
/>
(4)文字填空題(1 分)
在空白處填入適當(dāng)代碼,使按鈕顯示文字“點(diǎn)擊”。<Buttonandroid:layout_width="fill_parent"android:layout_height="wrap_content"______________></Button> ANSWER:android:text="點(diǎn)擊"(5)實(shí)戰(zhàn)代碼、視頻、截圖
5.1界面編程實(shí)戰(zhàn)1:實(shí)戰(zhàn)視頻
5.2相應(yīng)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"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:gravity="center_horizontal"android:orientation="vertical"><TextViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:text="注冊(cè)新用戶"android:gravity="center_horizontal"android:textSize="12pt"android:textStyle="bold"/></LinearLayout><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="用戶名:"android:textSize="10pt"/><EditTextandroid:layout_width="match_parent"android:layout_height="wrap_content"android:hint="請(qǐng)?zhí)顚懙顷戀~號(hào)"android:selectAllOnFocus="true"android:id="@+id/editText" /><TextViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:text="密碼:"android:textSize="10pt"/><EditTextandroid:layout_width="match_parent"android:layout_height="wrap_content"android:password="true"/><TextViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:text="電話號(hào)碼:"android:textSize="10pt"/><EditTextandroid:layout_width="match_parent"android:layout_height="wrap_content"android:hint="請(qǐng)?zhí)顚懩碾娫捥?hào)碼"android:phoneNumber="true"android:selectAllOnFocus="true"/><TextViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:text="出生日期:"android:textSize="10pt"/><EditTextandroid:layout_width="match_parent"android:layout_height="wrap_content"android:hint="請(qǐng)?zhí)顚懩愕某錾掌?#34;android:inputType="date"android:selectAllOnFocus="true"/><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:gravity="center_horizontal"><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="注 冊(cè)"/></LinearLayout> </LinearLayout><!--author CYJ 2018-01-22 -->(6)源碼鏈接
往期鏈接:<Android界面編程>? 任務(wù)一 ??醬油詩(shī)詞賞析?
總結(jié)
以上是生活随笔為你收集整理的[:zh]<界面编程>任务二 用户注册界面设计[:]2018-01-24的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: [:zh]<机械课程设计>五种表格自动填
- 下一篇: 推荐程序员的求爱技巧