[轉]android layout布局屬性

來源:互聯網
上載者:User

標籤:android   des   style   blog   http   java   

參考:http://blog.csdn.net/msmile_my/article/details/9018775

 

第一類:屬性值 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/id-name”

         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添加標籤

============================================================================================

為了更精確地控制應用程式在UI上的文字書寫順序(從左至右,或者從右至左),Android 4.2 引入了如下的API:

android:layoutDirection —該屬性設定組件的布局排列方向

android:textDirection — 該屬性設定組件的文字流向方向

android:textAlignment — 該屬性設定文字的對齊

getLayoutDirectionFromLocale() —該方法用於擷取指定地區的慣用布局方式

在使用從右至左的相片順序時,你甚至建立自訂的布局方式,可繪製對象,以及其他資源。僅僅是簡單地使用資源匹配器“ldrtl”對你的資源進行一下標識,你就可以把資源定義為“從右至左方向的資源”。在調試和最佳化從右至左的布局方面,HierarchyViewer目前支援對start/end屬性,布局方向,文字方向,文字對齊等所有資訊的層次化顯示。

  原文連結:http://blog.csdn.net/laurawan/article/details/18217259

聯繫我們

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