Android中View属性大全
2015-08-03 17:10
671 查看
android:alpha setAlpha(float) 设置alpha属性 0-1 完全透明到不透明
android:backgroud 背景
android:clickable 是否回应点击事件
android:contentDescription setContentDescription(CharSequence) 定义文字,简要介绍该视图内容。
android:drawingCacheQuality setDrawingCacheQuality(int)
设置绘图时半透明质量。有以下值可设置:auto(默认,由框架决定)/high(高质量,使用较高的颜色深度,消耗更多的内存)/low(低质量,使用较低的颜色深度,但是用更少的内存)。
android:duplicateParentState
如果设置此属性,将直接从父容器中获取绘图状态(光标,按下等)。 见下面代码部分,注意根据目前测试情况仅仅是获取绘图状态,而没有获取事件,也就是你点一下LinearLayout时Button有被点击的效果,但是不执行点击事件。
android:fadeScrollbars
setScrollbarFadingEnabled(boolean)
设置滚动条的自动隐藏,即不滚动的时候隐藏
android:fadingEdgeLength getVerticalFadingEdgeLength()
设置 边框渐变的长度。
android:filterTouchesWhenObscured setFilterTouchesWhenObscured(boolean)
view所在窗口被其它可见窗口遮住时,是否过滤触摸事件。
android:fitsSystemWindows setFitsSystemWindows(boolean)
设置布局调整时是否考虑系统窗口
设置是否获得焦点。若有requestFocus()被调用时,后者优先处理。注意在表单中想设置某一个如 EditText获取焦点,光设置这个是不行的,需要将这个EditText前面的focusable都设置为false才行。在Touch模式下获取焦点需要设置focusableInTouchMode为true。
设置在Touch模式下View是否能取得焦点。
设置长按时是否接受其他触摸反馈事件。
设置当前View为滚动容器。这里没有测试出效果来,ListView/ GridView/ ScrollView根本就不用设置这个属性,而EdidText设置android:scrollbars也能出滚动条。
android:keepScreenOn View在可见的情况下是否保持唤醒状态。
设置时候支持长按事件
设置视图最小高度
设置视图的最小高度
设置下方指定视图获得下一个焦点。焦点移动是基于一个在给定方向查找最近邻居的算法。如果指定视图不存在,移动焦点时将报运行时错误。可以设置imeOptions
指定点击后要执行的方法 这个方法在java代码里完成 例如buttonClick(View view)
设置边距
定义是否绘制竖直方向的滚动条 默认是不绘制
定义view的选择角度,API Level 11。
选择的基准点 API Level 11
设置是否在窗口冻结时(如旋转屏幕)保存View的数据,默认为true,但是前提是你需要设置id才能自动保存
设置缩放的基准点
android:scrollY android:scrollX
以像素为单位竖直和水平方向的移动距离
设置是否始终显示水平和竖直方向的滚动条
设置N毫秒后开始淡化,以毫秒为单位。
设置滚动条淡出效果(从有到慢慢的变淡直至消失)时间,以毫秒为单位。Android2.2中滚动条滚动完之后会消失,再滚动又会出来,在1.5、1.6版本里面会一直显示着。
设置滚动条的宽度
设置水平滚动条的图片或者颜色
设置滚动条背景(轨迹)的drawable注意直接设置颜色值如”android:color/white”将得出很难看的效果,甚至都不理解这个属性了,这里可以参见ApiDemos里res/drawable/ scrollbar_vertical_thumb.xml和scrollbar_vertical_track.xml,设置代码为:android:scrollbarTrackVertical ="@drawable/scrollbar_vertical_track"
设置滚动条显示。none(隐藏),horizontal(水平),vertical(垂直)
设置点击或触摸时是否有声音效果
设置标签
设置缩放和选择的点
设置可见性
本文转载自:/article/11826038.html
android:alpha setAlpha(float) 设置alpha属性 0-1 完全透明到不透明
android:backgroud 背景
android:clickable 是否回应点击事件
android:contentDescription setContentDescription(CharSequence) 定义文字,简要介绍该视图内容。
android:drawingCacheQuality setDrawingCacheQuality(int)
设置绘图时半透明质量。有以下值可设置:auto(默认,由框架决定)/high(高质量,使用较高的颜色深度,消耗更多的内存)/low(低质量,使用较低的颜色深度,但是用更少的内存)。
android:duplicateParentState
如果设置此属性,将直接从父容器中获取绘图状态(光标,按下等)。 见下面代码部分,注意根据目前测试情况仅仅是获取绘图状态,而没有获取事件,也就是你点一下LinearLayout时Button有被点击的效果,但是不执行点击事件。
android:fadeScrollbars
setScrollbarFadingEnabled(boolean)
设置滚动条的自动隐藏,即不滚动的时候隐藏
android:fadingEdgeLength getVerticalFadingEdgeLength()
设置 边框渐变的长度。
android:filterTouchesWhenObscured setFilterTouchesWhenObscured(boolean)
view所在窗口被其它可见窗口遮住时,是否过滤触摸事件。
android:fitsSystemWindows setFitsSystemWindows(boolean)
设置布局调整时是否考虑系统窗口
android:focusable | setFocusable(boolean) |
android:focusableInTouchMode | setFocusableInTouchMode(boolean) |
android:hapticFeedbackEnabled | setHapticFeedbackEnabled(boolean) |
android:id | setId(int) |
android:importantForAccessibility | setImportantForAccessibility(int) |
android:isScrollContainer | setScrollContainer(boolean) |
android:keepScreenOn | setKeepScreenOn(boolean) |
android:layerType | setLayerType(int,Paint) |
android:longClickable | setLongClickable(boolean) |
android:minHeight | setMinimumHeight(int) |
android:minWidth | setMinimumWidth(int) |
android:nextFocusLeft | setNextFocusLeftId(int) |
android:nextFocusRight | setNextFocusRightId(int) |
android:nextFocusUp | setNextFocusUpId(int) |
android:nextFocusDown | setNextFocusDownId(int) |
android:nextFocusForward | setNextFocusForwardId(int) |
android:onClick |
android:padding android:paddingBottom android:paddingLeft android:paddingRight android:paddingTop | setPadding(int,int,int,int) |
android:requiresFadingEdge | setVerticalFadingEdgeEnabled(boolean) |
android:rotation | setRotation(float) |
android:rotationX | setRotationX(float) |
android:rotationY | setRotationY(float) |
android:saveEnabled | setSaveEnabled(boolean) |
android:scaleX | setScaleX(float) |
android:scaleY | setScaleY(float) |
android:scrollY android:scrollX
以像素为单位竖直和水平方向的移动距离
android:scrollbarAlwaysDrawHorizontalTrack |
android:scrollbarAlwaysDrawVerticalTrack |
android:scrollbarDefaultDelayBeforeFade | setScrollBarDefaultDelayBeforeFade(int) |
android:scrollbarFadeDuration | setScrollBarFadeDuration(int) |
android:scrollbarSize | setScrollBarSize(int) |
android:scrollbarStyle | setScrollBarStyle(int) |
android:scrollbarThumbHorizontal |
android:scrollbarThumbVertical |
android:scrollbarTrackHorizontal |
android:scrollbarTrackVertical |
android:scrollbars |
android:soundEffectsEnabled | setSoundEffectsEnabled(boolean) |
android:tag |
android:transformPivotX | setPivotX(float) |
android:transformPivotY | setPivotY(float) |
android:visibility | setVisibility(int) |
本文转载自:/article/11826038.html
相关文章推荐
- 【Android应用开发技术:媒体开发】录像
- Android ListView的setEmptyView方法的使用
- Android Studio中如何引用图片资源
- android 遍历本地联系人
- Android之MVC模式
- 【Android】开机自启动Service
- 【Android】Service学习之本地服务
- 【Android】Service 生命周期
- Android自定义控件:如何使用自定义的XML属性
- 如何更快捷的设置Android Studio和Eclipse的快捷键一样和代码提示
- Android4.0 Launcher拖拽原理分析(1)
- Android ANR-Thermal condition
- Android屏幕保护KeyguardManager相关内容学习
- Android 适配横屏
- android中import出错,且该包切实存在的时候
- 【Android基础】AsyncTask学习——如何取消掉AsyncTask
- Android studio gradle 多渠道打包
- Android 自定义ListView控件,滑动删除
- 使用Android studio分析内存泄露
- 使用Android studio分析内存泄露