Android日常布局一

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

属性标志位
actionUnspecifiedEditorInfo.IME_ACTION_UNSPECIFIED.
actionNoneEditorInfo.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"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值