ViewGroup屬性小結(jié):
待改進(jìn)
屬性
-
android:addStatesFromChildren:Sets whether this ViewGroup's drawable states also include its children's drawable states.[booean]:定義父控件和子控件的狀態(tài)是否關(guān)聯(lián)。(子控件獲取焦點(diǎn)的時(shí)候,整個(gè)布局)例子:當(dāng)子控件獲取焦點(diǎn)的時(shí)候讓整個(gè)布局都獲取焦點(diǎn)。
android:alwaysDrawnWithCache:Defines whether the ViewGroup should always draw its children using their drawing cache or not. [boolean] 默認(rèn)為true:定義是否要一直使用緩沖來繪制控件。-
android:animateLayoutChanges:Defines whether changes in layout (caused by adding and removing items) should cause a LayoutTransition to run.[boolean]:定義布局改變時(shí)的動(dòng)畫。 設(shè)為true時(shí)會(huì)創(chuàng)建一個(gè)默認(rèn)的LayoutTransition對(duì)象和默認(rèn)的動(dòng)畫。方法
- setLayoutTranstiton(LayoutTransition)
android:animationCache:Defines whether layout animations should create a drawing cache for their children. [boolean]:定義父控件是否要為子控件創(chuàng)建繪制緩存。作用:優(yōu)化性能,但是會(huì)占用更多內(nèi)存-
android:clipChildren:Defines whether a child is limited to draw inside of its bounds or not.[boolean]默認(rèn)是
true:定義子控件是否要限制在父控件區(qū)域內(nèi)方法
- setClipChildren(boolean)
-
android:clipToPadding:Defines whether the ViewGroup will clip its children and resize (but not clip) any EdgeEffect to its padding, if padding is not zero. [boolean]默認(rèn)true:定義父控件會(huì)不會(huì)限制子控件的大小并且適配邊緣的填充。方法
- setClipToPadding(boolean)
-
android:descendantFocusability:Defines the relationship between the ViewGroup and its descendants when looking for a View to take focus.[enum]:定義父控件和子控件在獲取焦點(diǎn)時(shí)的關(guān)系屬性值
- beforeDescendants:0,The ViewGroup will get focus before any of its descendants.
- afterDescendants:1,The ViewGroup will get focus only if none of its descendants want it.
- blocksDescendants:2,The ViewGroup will block its descendants from receiving focus.
android:layoutAnimation: Defines the layout animation to use the first time the ViewGroup is laid out.[reference] :定義布局控件在退出的時(shí)候的動(dòng)畫-
android:layoutMode:Defines the layout mode of this ViewGroup. [enum]:定義布局的模式:屬性值
- clipBounds:0,Use the children's clip bounds when laying out this container.
- opticalBounds:1,Use the children's optical bounds when laying out this container.
方法
- setLayoutMode(int)
-
android:persistentDrawingCache:Defines the persistence of the drawing cache.[enum]:屬性值
- none:0x0,The drawing cache is not persisted after use.
- animation:0x1,The drawing cache is persisted after a layout animation.
- scrolling:0x2,The drawing cache is persisted after a scroll.
- all:0x3,The drawing cache is always persisted.
-
android:splitMotionEvents:Sets whether this ViewGroup should split MotionEvents to separate child views during touch event dispatch.[boolean] 默認(rèn)false:布局是否要將動(dòng)作事件分到子控件中。方法
- setMotionEventSplittingEnabled(boolean)