Android佈局的一些屬性值


第一類:屬性值 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 如果對應的兄弟元素找不到的話就以父元素做參照物

android:layout_alignParentStart緊貼父元素結束位置開始

android:layout_alignParentEnd緊貼父元素結束位置結束

android:animateLayoutChanges佈局改變時是否有動畫效果

android:clipChildren定義子佈局是否一定要在限定的區域內

android:clipToPadding定義佈局間是否有間距

android:animationCache定義子佈局也有動畫效果

android:alwaysDrawnWithCache定義子佈局是否應用繪圖的高速緩存

android:addStatesFromChildren定義佈局是否應用子佈局的背景

android:splitMotionEvents定義佈局是否傳遞touch事件到子佈局

android:focusableInTouchMode定義是否可以通過touch獲取到焦點

android:isScrollContainer定義佈局是否作爲一個滾動容器 可以調整整個窗體

android:fadeScrollbars滾動條自動隱藏

android:fitsSystemWindows設置佈局調整時是否考慮系統窗口(如狀態欄)

android:visibility定義佈局是否可見

android:requiresFadingEdge定義滾動時邊緣是否褪色

android:clickable定義是否可點擊

android:longClickable定義是否可長點擊

android:saveEnabled設置是否在窗口凍結時(如旋轉屏幕)保存View的數據

android:filterTouchesWhenObscured所在窗口被其它可見窗口遮住時,是否過濾觸摸事件

android:keepScreenOn設置屏幕常亮

android:duplicateParentState是否從父容器中獲取繪圖狀態(光標,按下等)

android:soundEffectsEnabled點擊或觸摸是否有聲音效果

android:hapticFeedbackEnabled設置觸感反饋


第二類:屬性值必須爲id的引用名“@id/idname”

android:layout_alignBaseline 本元素的文本與父元素文本對齊

android:layout_below 在某元素的下方

android:layout_above 在某元素的的上方

android:layout_toLeftOf 在某元素的左邊

android:layout_toRightOf 在某元素的右邊

android:layout_toStartOf本元素從某個元素開始

android:layout_toEndOf本元素在某個元素結束

android:layout_alignTop 本元素的上邊緣和某元素的的上邊緣對齊

android:layout_alignLeft 本元素的左邊緣和某元素的的左邊緣對齊

android:layout_alignBottom 本元素的下邊緣和某元素的的下邊緣對齊

android:layout_alignRight 本元素的右邊緣和某元素的的右邊緣對齊

android:layout_alignStart本元素與開始的父元素對齊

android:layout_alignEnd本元素與結束的父元素對齊

android:ignoreGravity 指定元素不受重力的影響

android:layoutAnimation定義佈局顯示時候的動畫

android:id 爲佈局添加ID方便查找

android:tag爲佈局添加tag方便查找與類似

android:scrollbarThumbHorizontal設置水平滾動條的drawable。

android:scrollbarThumbVertical設置垂直滾動條的drawable

android:scrollbarTrackHorizontal設置水平滾動條背景(軌跡)的色drawable

android:scrollbarTrackVertical設置垂直滾動條背景(軌跡)的色drawable

android:scrollbarAlwaysDrawHorizontalTrack 設置水平滾動條是否含有軌道

android:scrollbarAlwaysDrawVerticalTrack 設置垂直滾動條是否含有軌道

android:nextFocusLeft 設置左邊指定視圖獲得下一個焦點

android:nextFocusRight設置右邊指定視圖獲得下一個焦點

android:nextFocusUp設置上邊指定視圖獲得下一個焦點

android:nextFocusDown設置下邊指定視圖獲得下一個焦點

android:nextFocusForward設置指定視圖獲得下一個焦點

android:contentDescription 說明

android:OnClick 點擊時從上下文中調用指定的方法

         

第三類:屬性值爲具體的像素值,如30dip,40px,50dp

android:layout_width定義本元素的寬度

android:layout_height定義本元素的高度

android:layout_margin 本元素離上下左右間的距離

android:layout_marginBottom 離某元素底邊緣的距離

android:layout_marginLeft 離某元素左邊緣的距離

android:layout_marginRight 離某元素右邊緣的距離

android:layout_marginTop 離某元素上邊緣的距離

android:layout_marginStart本元素裏開始的位置的距離

android:layout_marginEnd本元素裏結束位置的距離

android:scrollX水平初始滾動偏移

android:scrollY垂直初始滾動偏移

android:background本元素的背景

android:padding指定佈局與子佈局的間距

android:paddingLeft指定佈局左邊與子佈局的間距

android:paddingTop指定佈局上邊與子佈局的間距

android:paddingRight指定佈局右邊與子佈局的間距

android:paddingBottom指定佈局下邊與子佈局的間距

android:paddingStart指定佈局左邊與子佈局的間距與android:paddingLeft相同

android:paddingEnd指定佈局右邊與子佈局的間距與android:paddingRight相同

android:fadingEdgeLength 設置邊框漸變的長度

android:minHeight最小高度

android:minWidth最小寬度

android:translationX 水平方向的移動距離

android:translationY垂直方向的移動距離

android:transformPivotX相對於一點的水平方向偏轉量

android:transformPivotY相對於一點的垂直方向偏轉量


第四類:屬性值問Android內置值的

android:gravity控件佈局方式

android:layout_gravity佈局方式

android:persistentDrawingCachehua定義繪圖的高速緩存的持久性   

android:descendantFocusability控制子佈局焦點獲取方式 常用於listView的item中包含多個控件 點擊無效

android:scrollbars設置滾動條的狀態

android:scrollbarStyle設置滾動條的樣式

android:fitsSystemWindows設置佈局調整時是否考慮系統窗口(如狀態欄)

android:scrollbarFadeDuration設置滾動條淡入淡出時間

android:scrollbarDefaultDelayBeforeFade設置滾動條N毫秒後開始淡化,以毫秒爲單位。

android:scrollbarSize設置滾動調大小

android:fadingEdge 設置拉滾動條時 ,邊框漸變的放向

android:drawingCacheQuality設置繪圖時半透明質量

android:OverScrollMode滑動到邊界時樣式

android:alpha設置透明度

android:rotation旋轉度數

android:rotationX水平旋轉度數

android:rotationY垂直旋轉度數

android:scaleX設置X軸縮放

android:scaleY設置Y軸縮放

android:verticalScrollbarPosition攝者垂直滾動條的位置

android:layerType設定支持

android:layoutDirection定義佈局圖紙的方向

android:textDirection定義文字方向

android:textAlignment文字對齊方式

android:importantForAccessibility設置可達性的重要行

android:labelFor添加標籤

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章