XML 属性 |
---|
属性名称 |
相关方法
| 描述 |
android:accessibilityLiveRegion | setAccessibilityLiveRegion(int) | Indicates to accessibility services whether the user should be notified when this view changes. |
android:accessibilityTraversalAfter | setAccessibilityTraversalAfter(int) | Sets the id of a view after which this one is visited in accessibility traversal. |
android:accessibilityTraversalBefore | setAccessibilityTraversalBefore(int) | Sets the id of a view before which this one is visited in accessibility traversal. |
android:alpha | setAlpha(float) | 设置视图的透明度,一个介于0(完全透明)和1(完全不透明)的值。 |
android:background | setBackgroundResource(int) | 设置背景 |
android:backgroundTint | setBackgroundTintList(ColorStateList) | 设置背景色调 |
android:backgroundTintMode | setBackgroundTintMode(PorterDuff.Mode) | 设置背景色调的混合模式 |
android:clickable | setClickable(boolean) | 设置View是否响应单击事件 |
android:contentDescription | setContentDescription(CharSequence) | 设置View主要的描述信息 |
android:drawingCacheQuality | setDrawingCacheQuality(int) | 设置View绘制缓存的质量 |
android:duplicateParentState | | When this attribute is set to true, the view gets its drawable state (focused, pressed, etc.) from its direct parent rather than from itself. |
android:elevation | setElevation(float) | base z depth of the view Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp ". |
android:fadeScrollbars | setScrollbarFadingEnabled(boolean) | Defines whether to fade out scrollbars when they are not in use. |
android:fadingEdgeLength | getVerticalFadingEdgeLength() | Defines the length of the fading edges. |
android:filterTouchesWhenObscured | setFilterTouchesWhenObscured(boolean) | Specifies whether to filter touches when the view's window is obscured by another visible window. |
android:fitsSystemWindows | setFitsSystemWindows(boolean) | Boolean internal attribute to adjust view layout based on system windows such as the status bar. |
android:focusable | setFocusable(boolean) | 设置View是否可以获取焦点 |
android:focusableInTouchMode | setFocusableInTouchMode(boolean) | Boolean that controls whether a view can take focus while in touch mode. |
android:hapticFeedbackEnabled | setHapticFeedbackEnabled(boolean) | Boolean that controls whether a view should have haptic feedback enabled for events such as long presses. |
android:id | setId(int) | 为View设置标识符,可通过findViewById方法获取 |
android:importantForAccessibility | setImportantForAccessibility(int) | Controls how this View is important for accessibility which is if it fires accessibility events and if it is reported to accessibility services that query the screen. |
android:isScrollContainer | setScrollContainer(boolean) | Set this if the view will serve as a scrolling container, meaing that it can be resized to shrink its overall window so that there will be space for an input method. |
android:keepScreenOn | setKeepScreenOn(boolean) | Controls whether the view's window should keep the screen on while visible. |
android:layerType | setLayerType(int,Paint) | Specifies the type of layer backing this view. |
android:layoutDirection | setLayoutDirection(int) | 设置布局图中的方向。 |
android:longClickable | setLongClickable(boolean) | 设置View是否响应长单击事件 |
android:minHeight | setMinimumHeight(int) | 设置View的最小高度 |
android:minWidth | setMinimumWidth(int) | 设置View的最小宽度 |
android:nextFocusDown | setNextFocusDownId(int) | 定义当向下搜索时应该获取焦点的View,如果该View不存在或不可见,则会抛出RuntimeException异常 |
android:nextFocusForward | setNextFocusForwardId(int) | 定义当向前搜索时应该获取焦点的View,如果该View不存在或不可见,则会抛出RuntimeException异常 |
android:nextFocusLeft | setNextFocusLeftId(int) | 定义当向左搜索时应该获取焦点的View,如果该View不存在或不可见,则会抛出RuntimeException异常 |
android:nextFocusRight | setNextFocusRightId(int) | 定义当向右搜索时应该获取焦点的View,如果该View不存在或不可见,则会抛出RuntimeException异常 |
android:nextFocusUp | setNextFocusUpId(int) | 定义当向上搜索时应该获取焦点的View,如果该View不存在或不可见,则会抛出RuntimeException异常 |
android:onClick | | 设置View点击事件的响应方法 |
android:padding | setPaddingRelative(int,int,int,int) | 设置View的内边距 |
android:paddingBottom | setPaddingRelative(int,int,int,int) | 设置View的下边距 |
android:paddingEnd | setPaddingRelative(int,int,int,int) | 设置View的终止边距 |
android:paddingLeft | setPadding(int,int,int,int) | 设置View的左边距 |
android:paddingRight | setPadding(int,int,int,int) | 设置View的右边距 |
android:paddingStart | setPaddingRelative(int,int,int,int) | 设置View的起始边距 |
android:paddingTop | setPaddingRelative(int,int,int,int) | 设置View的上边距 |
android:requiresFadingEdge | setVerticalFadingEdgeEnabled(boolean) | 设置在滚动时边缘是否淡出 |
android:rotation | setRotation(float) | 设置View旋转的角度 |
android:rotationX | setRotationX(float) | 设置View绕X轴旋转的角度 |
android:rotationY | setRotationY(float) | 设置View绕Y轴旋转的角度 |
android:saveEnabled | setSaveEnabled(boolean) | 如果未作设置,当View被冻结时将不会保存其状态 |
android:scaleX | setScaleX(float) | 设置View在水平方向上的缩放比 |
android:scaleY | setScaleY(float) | 设置View在垂直方向上的缩放比 |
android:scrollX | | 设置View在初始化后,在水平方向上的偏移 |
android:scrollY | | 设置View在初始化后,在垂直方向上的偏移 |
android:scrollbarAlwaysDrawHorizontalTrack | | 设置View是否总显示水平滚动条的轨迹 |
android:scrollbarAlwaysDrawVerticalTrack | | 设置View是否总显示垂直滚动条的轨迹 |
android:scrollbarDefaultDelayBeforeFade | setScrollBarDefaultDelayBeforeFade(int) | 设置View的滚动条在淡出之前延迟多少毫秒. |
android:scrollbarFadeDuration | setScrollBarFadeDuration(int) | 设置View的滚动条在淡出过程需要多少毫秒. |
android:scrollbarSize | setScrollBarSize(int) | 设置水平滚动条的高度和垂直滚动条的宽度 |
android:scrollbarStyle | setScrollBarStyle(int) | 设置滚动条的风格和位置 |
android:scrollbarThumbHorizontal | | 设置水平滚动条的滑块图片 |
android:scrollbarThumbVertical | | 设置垂直滚动条的滑块图片 |
android:scrollbarTrackHorizontal | | 设置水平滚动条的轨迹图片 |
android:scrollbarTrackVertical | | 设置垂直滚动条的轨迹图片 |
android:scrollbars | | 设置滚动条是垂直、水平还是隐藏(vertical、 horizonal、none) |
android:soundEffectsEnabled | setSoundEffectsEnabled(boolean) | 设置当View触发单击等事件时是否播放音效 |
android:stateListAnimator | | Sets the state-based animator for the View. |
android:tag | | 为View设置一个String类型的tag值,可以通过View的getTag()方法获取字符串,也可以通过findViewByTag()查找该View |
android:textAlignment | setTextAlignment(int) | 设置文字对齐的方式 |
android:textDirection | setTextDirection(int) | 设置文字的方向 |
android:transformPivotX | setPivotX(float) | 设置View旋转时旋转中心的X坐标 |
android:transformPivotY | setPivotY(float) | 设置View旋转时旋转中心的Y坐标 |
android:transitionName | | 为视图的转化起名,使得它可以被识别
|
android:translationX | setTranslationX(float) | 设置View在X轴方向的位移 |
android:translationY | setTranslationY(float) | 设置View在Y轴方向的位移 |
android:translationZ | setTranslationZ(float) | 设置View在Z轴方向的位移 |
android:visibility | setVisibility(int) | 设置View的可见性 |