xml属性 | 对应的方法 | 说明 |
---|---|---|
android:alpha | setAlpha(float) | 设置组件的透明度(0——1) |
android:background | setBackgroundResource(int) | 设置背景 |
android:clickable | setClickable(boolean) | 设置是否可以接收点击事件并触发 |
android:duplicateParentState | 设置为true的时候可以直接从他直接的父组件中获取其状态(focused, pressed, etc.) | |
android:fadeScrollbars | setScrollbarFadingEnabled(boolean) | 但不使用滚动条时是否淡出显示滚动条 |
android:fadingEdgeLength | setVerticalFadingEdgeLength() | 设置淡出边界的长度 |
android:fitsSystemWindows | setFitsSystemWindows(boolean) | 设置布局适应系统,比如说状态栏 |
android:focusable | setFocusable(boolean) | 是否可获取焦点 |
android:id | setId(int) | 设置Id |
android:keepScreenOn | setKeepScreenOn(boolean) | 设置该组件是否会强制手机屏幕一直打开 |
android:layerType | setLayerType(int,Paint) | 设置硬件加速 |
android:layoutDirection | setLayoutDirection(int) | 设置布局从左向右,或从右向左,etc |
android:longClickable | setLongClickable(boolean) | 设置是否可以接收长点击事件并触发 |
android:minHeight/minWidth | setMinimumHeight(int)/setMinimumWidth | 设置最小高(宽)度 |
android:nextFocusDown系 | setNextFocusDownId(int) | 设置焦点在该组件上且点击向下\左\右\上 键时获得焦点的组件Id |
android:onClick | 点击时触发的方法 | |
android:padding系 | setPadding(int,int,int,int) | 设置内边距 |
android:rotation系 | setRotation(float) | 设置旋转角度 |
android:scaleX/Y | setScaleX/Y(float) | 水平/垂直方向的缩放比 |
android:scrollX/Y | 初始化后组件的水平/垂直偏移 | |
android:scrollbarSize | setScrollBarSize(int) | 设置水平滚动条的高度和垂直滚动条的宽度 |
android:scrollbarStyle | setScrollBarStyle(int) | 设置滚动条的风格:insideOverlay、insideInset、outSideOverlay、outSideInset |
android:scrollbarThumbHorizontal | 设置滚动条的Drawable对象 | |
android:scrollbars | 设置是否显示滚动条或显示什么滚动条 | |
android:soundEffectsEnabled | setSoundEffectsEnabled(boolean) | 设置组件按下后是否使用音效 |
android:tag | 和Id类似也可通过View.findViewWithTag()获取 | |
android:textAlignment | setTextAlignment(int) | 定义文字的对齐方式 |
android:transformPivotX/Y | setPivotX/Y(float) | 设置旋转时的中心坐标X/Y |
android:translationX/Y/Z | setTranslationX/Y/Z(float) | 设置位移 |
android:visibility | setVisibility(int) | 设置是否可见 |
android:elevation | setElevation(float) | 设置该组件“浮”起来的高度,来呈现3D效果,android5.0 Material Design新增的属性 |
xml 基础属性
猜你喜欢
转载自www.cnblogs.com/the-wang/p/9117173.html
今日推荐
周排行