1. 程式人生 > >android之View組件的XML屬性集合

android之View組件的XML屬性集合

中心 sca 模式 scrip ott outside rmp down float

XML屬性 相關方法 說明
android:alpha setAlpha(float) 設置該組件的透明度
android:background setBackgroundResource(int) 設置該組件的背景顏色
android:clickable setClickable(boolean) 設置該組件是否可以激發單擊事件
android:contentDescription setContentDescription(CharSequence) 設置該組件的主要描述信息
android:drawingCacheQuality setDrawingCacheQuality(int) 設置該組件所使用的繪制緩存的質量
android:fadeScrollbars setScrollbarFadingEnabled(boolean) 當不使用該組件的滾動條時,是否淡出顯示滾動條
android:fadingEdge setVerticalFadingEdgeEnabled(boolean) 設置滾動該組件時組件邊界是否使用淡出效果
android:fadingEdgeLength getVerticalFadingEdgeLength() 設置淡出邊界的長度
android:focusable setFocusable(boolean) 設置該組件是否可以得到焦點
android:focusableInTouchMode setFocusableInTouchMode(boolean) 設置該組件在觸摸模式下是否可以得到焦點
android:id setId(int) 設置該組件的唯一標識。Java代碼中可通過findViewById來獲取它
android:isScrollContainer setScrollContainer(boolean) 設置該組件是否是作為可滾動容器使用
android:keepScreenOn setKeepScreenOn(boolean) 設置該組件是否會強制手機屏幕一直打開
android:longCLickable setLongClickable(boolean) 設置該組件是否可以響應長單擊事件
android:minHeight setMinimumHeight(int) 設置該組件的最小高度
android:minWidth setMinimumWidth(int) 設置該組件的最小寬度
android:nextFocusDown setNextFocusDownId(int) 設置焦點在該組件上,且按向下鍵時獲得焦點的組件ID
android:nextFocusLeft setNextFocusLeftId(int) 設置焦點在該組件上,且按向左鍵時獲得焦點的組件ID
android:nextFocusRight setNextFocusRightId(int) 設置焦點在該組件上,且按向右鍵時獲得焦點的組件ID
android:nextFocusUp setNextFocusUpId(int) 設置焦點在該組件上,且按向上鍵時獲得焦點的組件ID
android:onClick 為該組件的單擊事件綁定監聽器
android:padding setPadding(int,int,int,int) 在該組件的四邊設置填充區域
android:paddingBottom setPadding(int,int,int,int) 在該組件的下邊設置填充區域
android:paddingLeft setPadding(int,int,int,int) 在該組件的左邊設置填充區域
android:paddingRight setPadding(int,int,int,int) 在該組件的右邊設置填充區域
android:paddingTop setPadding(int,int,int,int) 在該組件的上邊設置填充區域
android:rotation setRotation(float) 設置該組件旋轉的角度
android:rotationX setRotationX(float) 設置該組件繞X軸旋轉的角度
android:rotationY setRotationY(float) 設置該組件繞Y軸旋轉的角度
android:saveEnabled setSaveEnabled(boolean) 如果設置為false,那當該組件被凍結時不會保存它的狀態
android:scaleX setScaleX(float) 設置該組件在水平方向的縮放比
android:scaleY setScaleY(float) 設置該組件在垂直方向的縮放比
android:scrollX 該組件初始化後的水平滾動偏移
android:scrollY 該組件初始化後的垂直滾動偏移
android:scrollbarAlwaytsDrawHorizontalTrack 設置該組件是否總是顯示水平滾動條的軌道
android:scrollbarAlwaytsDrawVerticalTrack 設置該組件是否總是顯示垂直滾動條的軌道
android:scrollDefaultDelayBeforFade setScrollbarDefaultBeforeFade(int) 設置滾動條在淡出隱藏之前延遲多少毫秒
android:scrollbarFadeDuration setScrollBarFadeDuration(int) 設置滾動條淡出隱藏過程需要多少秒
android:scrollbarSize setScrollBarSize(int) 設置垂直滾動條的寬度和水平滾動條的高度
android:scrollbarStyle setScrollBarStyle(int) 設置滾動條的風格和位置。該屬性支持如下屬性值:insideOverlay,insideInset,outsideOverlay,outsideInset
android:scrollbarThumbHorizontal 設置該組件的水平滾動條的滑動對應的Drawable對象
android:scrollbarThumbVertical 設置該組件的垂直滾動條的滑動對應的Drawable對象
android:scrollbarTrackHorizontal 設置該組件的水平滾動條的軌道對應的Drawable對象
android:scrollbarTrackVertical 設置該組件的垂直滾動條的軌道對應的Drawable對象
android:scrollbars 定義該組件滾動時顯示幾個滾動。該屬性支持如下屬性值:none(不顯示滾動條),horizontal(顯示水平滾動條),vertical(顯示垂直滾動條)
android:soundEffecctsEnabled setSoundEffectsEnabled(boolean) 設置組件被單擊時是否使用音效
android:tag 為該組件設置一個字符串類型的tag值,接下來可通過view的getTag()獲取該字符串,或通過findViewWithTag()查找該組件
android:transformPivotX setPivotX(float) 設置該組件旋轉時旋轉中心的X坐標
android:transformPivotY setPivotY(float) 設置該組件旋轉時旋轉中心的Y坐標
android:translationX setTranslationX(float) 設置該組件在X方向上的位移
android:translationY setTranslationY(float) 設置該組件在Y方向上的位移
android:visibility seVisibility(int) 設置該組件是否可見

android之View組件的XML屬性集合