ScrollView
- 只能包含一个控件
FrameLayout
- 越迟添加的控件处于越上层
layout
- 命名必须小写
常用属性
descendantFocusability
- beforeDescendants:viewgroup会优先其子类控件而获取到焦点
- afterDescendants:viewgroup只有当其子类控件不需要获取焦点时才获取焦点
- blocksDescendants:viewgroup会覆盖子类控件而直接获得焦点
ellipsize
- 设置省略号位置
weight
- weight在fill_parent情况下的权重计算,计算剩余空间的权重,然后求和
transcriptMode
- Android控件(支持ScrollBar)自动滑动到最底部(“alwaysScroll”)
ListView
- 自动显示隐藏进度条
android:fadeScrollbars="true"
- 显示列表最后一条
stackFromBottom="true"
- 去除滑动阴影
android:fadingEdge="none"
android: overScrollMode="never" - 选择颜色显示位置
drawSelectorOnTop
- 背景颜色为图片时,设置缓存为透明
CacheColorHint="#00000000"
EditText
InputType
- number 接受整数输入
- numberSigned 接受有符号整数输入
- numberDecimal 接受整数和小数的输入
digits
- 指定固定数字
android:digits="012345"
当InputType属性为number时,lines失效
默认外观
android:textAppearance="?android:attr/textAppearanceSmall"
imeOptions
属性 | 标志位 |
---|---|
actionUnspecified | EditorInfo.IME_ACTION_UNSPECIFIED. |
actionNone | EditorInfo.IME_ACTION_NONE |
actionGo 去往 | EditorInfo.IME_ACTION_GO |
actionSearch 搜索 | EditorInfo.IME_ACTION_SEARCH |
actionSend 发送 | EditorInfo.IME_ACTION_SEND |
actionNext 下一个 | EditorInfo.IME_ACTION_NEXT |
actionDone 完成 | EditorInfo.IME_ACTION_DONE |
style
- 引导界面不显示title
<item name="android:windowNoTitle">true</item>
- 对话框style
<style name="CustomDialog" parent="@android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item>//Dialog的windowFrame框为无
<item name="android:windowIsFloating">true</item>//是否浮现在activity之上
<item name="android:windowContentOverlay">@null</item>//是否允许背景灰暗
<item name="android:windowAnimationStyle">
@android:style/Animation.Dialog</item>//对话框的进入和退出动画
//可控制软键盘的显示与否
<item name="android:windowSoftInputMode">
stateUnspecified|adjustPan</item>
</style>
imageView
- 按比例放大缩小图片
android: scaleType="fitXY"