Android switch button初步了解


XML Attributes
Attribute Name
Related Method
Description
android:switchMinWidth setSwitchMinWidth(int) Minimum width for the switch component

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 

android:switchPadding setSwitchPadding(int) Minimum space between the switch and caption text

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 

android:switchTextAppearance setSwitchTextAppearance(Context,int) TextAppearance style for text displayed on the switch thumb. 
android:textOff setTextOff(CharSequence) Text to use when the switch is in the unchecked/"off" state. 
android:textOn setTextOn(CharSequence) Text to use when the switch is in the checked/"on" state. 
android:textStyle setSwitchTypeface(Typeface) Style (bold, italic, bolditalic) for the text. 
android:thumb setThumbResource(int) Drawable to use as the "thumb" that switches back and forth. 
android:thumbTextPadding setThumbTextPadding(int) Amount of padding on either side of text within the switch thumb. 
android:track setTrackResource(int) Drawable to use as the "track" that the switch thumb slides within. 
android:typeface setSwitchTypeface(Typeface) Typeface (normal, sans, serif, monospace) for the text. 

以上是switch的方法,switch是Android4.0中的新控件,用来滑动选择开关和 ToggleButton类似;
  • android:switchMinWidth:百度翻译--》开关元件的最小宽度必须是一个维度的价值,这是一个浮点数附有单位如“14.5sp”。
就是切换的开关背景宽度:






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值