日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

安卓界面组件-文本框

發(fā)布時(shí)間:2025/3/15 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 安卓界面组件-文本框 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

??? 前面三篇文章本質(zhì)上是圍繞著View類進(jìn)行的。View是安卓UI的基礎(chǔ)類,我們的安卓開發(fā)“千里之行”是從View開始的。

??? 安卓界面UI有大量的組件,組件的繼承和間接繼承于View。有一類組件很基本,這就是TextView文本框,作用是顯示文本。在TextView基礎(chǔ)上,TextView派生出:EditText CheckedTextView Button DigitalClock Chronometer等幾個(gè)子類控件,強(qiáng)化了TextView的功能。這一節(jié)介紹一下TextView和EditText類

一? EditText

??? EditText屬性:

?????????????????????? android:autoLink???? 將文本轉(zhuǎn)換為可點(diǎn)擊的超鏈接形式,取值:none web email phone map all

?????????????????????? android:drawableBottom????? 在文本下方繪制圖片,類似的屬性還有android:drawableLeft ?android:drawableTop ?android:drawableRight

?????????????????????? android:gravity??????? 顯示文本的對(duì)其方式

?????????????????????? android:inputType??? 文本輸入形式

?????????????????????? android:hint???????????? 提示

?????????????????????? android:textColor???? 文本顏色

實(shí)際操作:設(shè)計(jì)出超鏈接形式文本和有圖片文本,多行文本

請(qǐng)閱讀xml,找出設(shè)置上面文本框效果的屬性

<TextViewandroid:id="@+id/textView1"android:layout_width="fill_parent"android:layout_height="wrap_content"android:autoLink="email"android:text="@string/mail" /><TextViewandroid:id="@+id/textView2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:drawableBottom="@drawable/ic_launcher"android:text="@string/icon" /><TextViewandroid:id="@+id/textView3"android:layout_width="wrap_content"android:layout_height="wrap_content"android:singleLine="false"android:text="@string/longText" />

二??? 編輯框

???? 編輯框的作用是在屏幕進(jìn)行文本編輯,實(shí)際上是TextView打開文本編輯功能形成的組件。EditText的特殊屬性肯定是和文本編輯有關(guān),相關(guān)屬性如下

???? EditText屬性:

???????????????????????? android:inputType????? 輸入文本類型,基本類型有密碼,電話等等;可以通過ctrl + /查看

???????????????????????? android:singleLine????? 是否單行輸入

實(shí)際操作:制作一個(gè)注冊(cè)界面

相關(guān)xml代碼如下,比較簡(jiǎn)單

<TableLayoutandroid:layout_width="match_parent"android:layout_height="match_parent" ><TableRowandroid:id="@+id/tableRow1"android:layout_width="wrap_content"android:layout_height="wrap_content" ><TextViewandroid:id="@+id/textView1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="姓名:" /><EditTextandroid:id="@+id/editText1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:ems="10"android:inputType="textPersonName" ><requestFocus /></EditText></TableRow><TableRowandroid:id="@+id/tableRow2"android:layout_width="wrap_content"android:layout_height="wrap_content" ><TextViewandroid:id="@+id/textView2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="屬兔密碼:" /><EditTextandroid:id="@+id/editText2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:ems="10" /></TableRow><TableRowandroid:id="@+id/tableRow3"android:layout_width="wrap_content"android:layout_height="wrap_content" ><TextViewandroid:id="@+id/textView3"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="確認(rèn)密碼:" /><EditTextandroid:id="@+id/editText3"android:layout_width="wrap_content"android:layout_height="wrap_content"android:ems="10" /></TableRow><TableRowandroid:id="@+id/tableRow4"android:layout_width="wrap_content"android:layout_height="wrap_content" ></TableRow><Buttonandroid:id="@+id/button1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="提交" /></TableLayout>

總結(jié):以上是安卓基本文本控件,用于界面文本顯示。

??????? 水平有限,請(qǐng)留言!

?

轉(zhuǎn)載于:https://www.cnblogs.com/divingpig/p/6434700.html

總結(jié)

以上是生活随笔為你收集整理的安卓界面组件-文本框的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。