android textview xml 屬性設定

來源:互聯網
上載者:User

android:ems 設定TextView的寬度為N個字元的寬度。
android:maxems 設定TextView的寬度為最長為N個字元的寬度。與ems同時使用時覆蓋ems選項。
android:minems 設定TextView的寬度為最短為N個字元的寬度。與ems同時使用時覆蓋ems選項。
android:maxLength 限制輸入字元數。如設定為5,那麼僅可以輸入5個漢字/數字/英文字母。
android:lines 設定文本的行數,設定兩行就顯示兩行,即使第二行沒有資料。
android:maxLines 設定文本的最大顯示行數,與width或者layout_width結合使用,超出部分自動換行,超出行數將不顯示。
android:minLines 設定文本的最小行數,與lines類似。
android:lineSpacingExtra 設定行間距。
android:lineSpacingMultiplier 設定行間距的倍數。如”1.2”
android:numeric 如果被設定,該TextView有一個數字IME。有如下值設定:integer正整數、signed帶正負號的整數、decimal帶小數點浮點數。
android:password 以小點”.”顯示文本
android:phoneNumber 設定為電話號碼的輸入方式。

android:singleLine 設定單行顯示。如果和layout_width一起使用,當文本不能全部顯示時,後面用“…”來表示。如android:text="test_ singleLine " android:singleLine="true" android:layout_width="20dp"將只顯示“t…”。如果不設定singleLine或者設定為false,文本將自動換行


android:textAppearance 設定文字外觀。如“?android:attr/textAppearanceLargeInverse”這裡引用的是系統內建的一個外觀,?表示系統是否有這種外觀,否則使用預設的外觀。可設定的值如下:textAppearanceButton/textAppearanceInverse/textAppearanceLarge/textAppearanceLargeInverse/textAppearanceMedium/textAppearanceMediumInverse/textAppearanceSmall/textAppearanceSmallInverse
android:textColor 設定文本顏色
android:textColorHighlight 被選中文字的底色,預設為藍色
android:textColorHint 設定提示資訊文字的顏色,預設為灰色。與hint一起使用。
android:textColorLink 文字連結的顏色.
android:textScaleX 設定文字之間間隔,預設為1.0f。參見TextView的。
android:textSize 設定文字大小,推薦度量單位”sp”,如”15sp”
android:textStyle 設定字形[bold(粗體) 0, italic(斜體) 1, bolditalic(又粗又斜) 2] 可以設定一個或多個,用“|”隔開
android:typeface 設定文本字型,必須是以下常量值之一:normal 0, sans 1, serif 2, monospace(等寬字型) 3]


android:height 設定文本地區的高度,支援度量單位:px(像素)/dp/sp/in/mm(毫米)
android:maxHeight 設定文本地區的最大高度
android:minHeight 設定文本地區的最小高度
android:width 設定文本地區的寬度,支援度量單位:px(像素)/dp/sp/in/mm(毫米),與layout_width的區別看這裡。
android:maxWidth 設定文本地區的最大寬度
android:minWidth 設定文本地區的最小寬度

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.