android 介面屬性

來源:互聯網
上載者:User

 

RelativeLayout用到的一些重要的屬性:

第一類:屬性值為true或false
android:layout_centerHrizontal                                           水平置中
android:layout_centerVertical                                            垂直置中
android:layout_centerInparent                                           相對於父元素完全置中
android:layout_alignParentBottom                                     貼緊父元素的下邊緣
android:layout_alignParentLeft                                          貼緊父元素的左邊緣
android:layout_alignParentRight                                        貼緊父元素的右邊緣
android:layout_alignParentTop                                          貼緊父元素的上邊緣
android:layout_alignWithParentIfMissing                            如果對應的兄弟元素找不到的話就以父元素做參照物

第二類:屬性值必須為id的引用名“@id/id-name”
android:layout_below                          在某元素的下方
android:layout_above                          在某元素的的上方
android:layout_toLeftOf                       在某元素的左邊
android:layout_toRightOf                     在某元素的右邊

android:layout_alignTop                      本元素的上邊緣和某元素的的上邊緣對齊
android:layout_alignLeft                      本元素的左邊緣和某元素的的左邊緣對齊
android:layout_alignBottom                 本元素的下邊緣和某元素的的下邊緣對齊
android:layout_alignRight                    本元素的右邊緣和某元素的的右邊緣對齊

第三類:屬性值為具體的像素值,如30dip,40px
android:layout_marginBottom              離某元素底邊緣的距離
android:layout_marginLeft                   離某元素左邊緣的距離
android:layout_marginRight                 離某元素右邊緣的距離
android:layout_marginTop                   離某元素上邊緣的距離

android:padding="15dip"             padding是指內邊距(也就是指內容與邊框的距離),layout_margin為外邊距(它的上一層與邊框的距離)。

 

TextView

android:hint setHint(int)

當TextView中顯示的內容為空白時,顯示該文本

android:typeface setTypeface(Typeface) 設定TextView的文本字型
android:ellipsize setEllipsize(TextUtils.TruncateAt) 若是設定了該屬性,當TextView中要顯示的內容跨越了TextView的長度時,會對內容進行省略。可取的值有start、middle、end和marquee

EditText
 

android:shadowColor setShadowLayer(float,float,float,int) 為文字框設定指定色彩的暗影
droid:shadowRadius setShadowLayer(float,float,float,int) 為文字框設定暗影的半徑,為浮點數
android:singleLine setTransformationMethod(TransformationMethod) 設定文字框的單行模式

 

相關文章

聯繫我們

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