最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android開發(fā)手冊(cè)TextInputLayout樣式使用示例

 更新時(shí)間:2022年06月10日 17:22:39   作者:芝麻粒兒  
這篇文章主要為大家介紹了Android開發(fā)手冊(cè)TextInputLayout樣式使用示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪

前言

前面小空帶同學(xué)們學(xué)了EditText控件,又用其實(shí)踐做了個(gè)驗(yàn)證碼功能,以為這就完了嗎?

然而并沒有。

Android在5.0以后引入了Materia Design庫的設(shè)計(jì),現(xiàn)在又有了Jetpack UI庫的設(shè)計(jì)。幫助開發(fā)者更高效的實(shí)現(xiàn)炫酷的UI界面,降低開發(fā)門檻。

Jetpack我們后面再說,承接之前的EditText,先說說Materia Design里的TextInputLayout。

使用方式是將TextInputEditText或EditText套到TextInputLayout內(nèi),這樣友情提示信息hit就可以帶有動(dòng)畫(上浮為標(biāo)題),計(jì)數(shù)/密碼可見等屬性設(shè)置。  

布局代碼

<com.google.android.material.textfield.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="請(qǐng)輸入用戶名">
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="number" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="60dp"
    android:hint="請(qǐng)輸入密碼">
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>

這樣就簡單的實(shí)現(xiàn)了一個(gè)效果。我們?cè)诶^續(xù)深入添加些屬性:

<com.google.android.material.textfield.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="請(qǐng)輸入用戶名"
    app:hintAnimationEnabled="false">
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="number" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="60dp"
    android:hint="請(qǐng)輸入密碼"
    app:counterEnabled="true"
    app:counterMaxLength="10"
    app:passwordToggleEnabled="true">
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>

從運(yùn)行結(jié)果可以看出,設(shè)置了字?jǐn)?shù)限制后,自動(dòng)在編輯框右下角顯示最大字?jǐn)?shù)和當(dāng)前輸入字?jǐn)?shù)(隨著輸入情況實(shí)時(shí)變化),并且更改了顏色樣式

??屬性介紹

  • app:boxCollapsedPaddingTop 設(shè)置用于編輯文本在框模式下折疊的頂部填充的值 
  • app:boxStrokeErrorColor 在顯示錯(cuò)誤時(shí)設(shè)置輪廓框的描邊顏色。 
  • app:boxStrokeWidth 設(shè)置描邊的寬度 
  • app:boxStrokeWidthFocused 設(shè)置獲取焦點(diǎn)框的描邊寬度 
  • app:counterEnabled     是否顯示計(jì)數(shù)器 
  • app:counterMaxLength 設(shè)置計(jì)數(shù)器的最大值,與counterEnabled同時(shí)使用 
  • app:counterTextAppearance       計(jì)數(shù)器的字體樣式 
  • app:counterOverflowTextAppearance 輸入字符大于我們限定個(gè)數(shù)字符時(shí)的字體樣式 
  • app:errorEnabled  是否顯示錯(cuò)誤信息 
  • app:errorTextAppearance&nbsp;   錯(cuò)誤信息的字體樣式 
  • app:endIconCheckable 設(shè)置是否顯示結(jié)束圖標(biāo) 
  • app:endIconContentDescription 為結(jié)束圖標(biāo)設(shè)置內(nèi)容說明 
  • app:endIconDrawable 設(shè)置結(jié)束圖標(biāo)圖像 
  • app:endIconMode 設(shè)置模式 
  • app:endIconTintMode 指定混合模式,用于將 指定的色調(diào)應(yīng)用于可繪制的結(jié)束圖標(biāo)。 
  • app:helperText 設(shè)置幫助文本 
  • app:helperTextEnabled 設(shè)置是否激活幫助文本 
  • app:helperTextTextColor 設(shè)置幫助文本顏色 
  • app:hintAnimationEnabled  是否顯示hint的動(dòng)畫,默認(rèn)true 
  • app:hintEnabled    是否使用hint屬性,默認(rèn)true 
  • app:hintTextAppearance      設(shè)置hint的文字樣式(指運(yùn)行動(dòng)畫效果之后的樣式) 
  • app:passwordToggleDrawable    設(shè)置密碼開關(guān)Drawable圖片,于passwordToggleEnabled同時(shí)使用 
  • app:passwordToggleEnabled      是否顯示密碼開關(guān)圖片,需要EditText設(shè)置inputType 
  • app:passwordToggleTint     設(shè)置密碼開關(guān)圖片顏色 
  • app:passwordToggleTintMode    設(shè)置密碼開關(guān)圖片(混合顏色模式),與passwordToggleTint同時(shí)使用

以上就是Android開發(fā)手冊(cè)TextInputLayout樣式使用示例的詳細(xì)內(nèi)容,更多關(guān)于Android開發(fā)TextInputLayout樣式的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • Android開發(fā)實(shí)現(xiàn)讀取Assets下文件及文件寫入存儲(chǔ)卡的方法

    Android開發(fā)實(shí)現(xiàn)讀取Assets下文件及文件寫入存儲(chǔ)卡的方法

    這篇文章主要介紹了Android開發(fā)實(shí)現(xiàn)讀取Assets下文件及文件寫入存儲(chǔ)卡的方法,涉及Android文件與目錄的讀取、寫入、轉(zhuǎn)換等相關(guān)操作技巧,需要的朋友可以參考下
    2017-10-10
  • android打開rar壓縮文件

    android打開rar壓縮文件

    這篇文章主要介紹了android打開rar壓縮文件示例,調(diào)用RAR for android 打開壓縮文件,需要的朋友可以參考下
    2014-03-03
  • Android使用OkHttp發(fā)送post請(qǐng)求

    Android使用OkHttp發(fā)送post請(qǐng)求

    這篇文章主要為大家詳細(xì)介紹了Android使用OkHttp發(fā)送post請(qǐng)求,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-11-11
  • Android Flutter表格組件Table的使用詳解

    Android Flutter表格組件Table的使用詳解

    Table組件不同于其它Flex布局,它是直接繼承的RenderObjectWidget的。本篇文章主要介紹如何在頁面中使用表格做一個(gè)記錄,感興趣的可以嘗試一下
    2022-06-06
  • 手機(jī)/移動(dòng)前端開發(fā)需要注意的20個(gè)要點(diǎn)

    手機(jī)/移動(dòng)前端開發(fā)需要注意的20個(gè)要點(diǎn)

    本文主要介紹了手機(jī)/移動(dòng)前端開發(fā)需要注意的20個(gè)要點(diǎn),具有很好的參考價(jià)值。下面跟著小編一起來看下吧
    2017-03-03
  • Android中主要資源文件及文件夾介紹

    Android中主要資源文件及文件夾介紹

    在Android項(xiàng)目文件夾里面,主要的資源文件是放在res文件夾里面的,下面為大家詳細(xì)介紹下各個(gè)資源文件的作用,感興趣的朋友可以參考下哈
    2013-06-06
  • Android 添加系統(tǒng)服務(wù)的方法詳解

    Android 添加系統(tǒng)服務(wù)的方法詳解

    這篇文章主要介紹了Android 添加系統(tǒng)服務(wù)的方法詳解,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-02-02
  • Android數(shù)據(jù)存儲(chǔ)之SQLite使用

    Android數(shù)據(jù)存儲(chǔ)之SQLite使用

    SQLite是D.Richard Hipp用C語言編寫的開源嵌入式數(shù)據(jù)庫引擎。它支持大多數(shù)的SQL92標(biāo)準(zhǔn),并且可以在所有主要的操作系統(tǒng)上運(yùn)行
    2016-01-01
  • Android給任何view添加全屏傾斜水印

    Android給任何view添加全屏傾斜水印

    本篇文章主要介紹了Android給任何view添加全屏傾斜水印,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-10-10
  • Android手機(jī)獲取Mac地址的幾種方法

    Android手機(jī)獲取Mac地址的幾種方法

    今天小編就為大家分享一篇關(guān)于Android手機(jī)獲取Mac地址的幾種方法,小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧
    2019-02-02

最新評(píng)論

纳雍县| 南宫市| 穆棱市| 泗洪县| 长宁县| 凤山县| 城口县| 历史| 犍为县| 汶川县| 云梦县| 寿宁县| 上蔡县| 且末县| 集安市| 东平县| 白河县| 武山县| 藁城市| 平乡县| 阳高县| 错那县| 闽清县| 新竹县| 永平县| 阿瓦提县| 东城区| 江华| 潜江市| 南安市| 临汾市| 油尖旺区| 萨嘎县| 郎溪县| 九龙县| 临猗县| 项城市| 承德县| 兴城市| 府谷县| 嵊泗县|