Android Layout


layout_width和layout_hight使用參數如下
wrap_content:可以確保物件是被包裹,最小化的方框 
match_parent:使物件方框與螢幕同等大小

 



TextStyle是用於把文字變粗體或斜體 
textAlignment用於把文字放到檢視圖的左側、右側或中心位置 

android:textColor="@android:color/white"中 @android:color指的是使用標準Android的顏色,如果不想使用Android的顏色可直接使用hex code(十六進位碼)

background雖然是整個畫面背景,但是無法使用圖片視窗當背景
scaleType會改變在視窗內圖像的大小
layout-height和layout_width會改變視窗的大小


 padding V.S. layout_margin
 



center:置中不會改變圖像大小
centerCrop:將圖片等比放大置實際大小後置中,如下圖所示

 綠色的方框表示實際圖片的大小
 使用CenterCrop指令會將圖片放大至實際大小後
置中,並將多出螢幕的部分做切割






No comments:

Post a Comment