安卓開發學習日記 DAY3——TextView,EditView,ImageView

來源:互聯網
上載者:User

標籤:

今天學習了一些控制項的使用方法,包括TextView,EditView,ImageView

1.TextView,輸出一個文本唄

主要屬性有

android:id        標誌

android:layout_width   寬度

android:layout_height  高度

android:text        常值內容

android:textsize      文字大小

android:textcolor    文本顏色

android:background    背景

2.EditView,輸入一個文本唄

主要屬性相同

另外有

android:hint     輸入提示文本

android:inputType   輸入文本類型

這裡要說一下hint屬性,與text屬性在EditView中使用的不同

簡單來說,如果你把hint或text設定為“123”

當你輸入“456”時

hint為“456”

而text為“123456“

3.ImageView,一個顯示圖片的空間

屬性差不多

另外Android:src 圖片源

此處注意兩點

1)android:layout_width有三個比較特殊的值

  match_parents:擴大控制項使之盡量佔滿其父單元的所有空間

  wrap_content:根據內容擴大控制項

  fill_parents:與match_parents相似 API2.2後很少使用

2)src與background的區別

  當你使用src和background同時載入一個圖片時

  src不會填滿整個空間,不會根據空間大小展開,background反之

以上

安卓開發學習日記 DAY3——TextView,EditView,ImageView

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.