关闭

Android switch button初步了解

513人阅读 评论(0) 收藏 举报

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

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:2299次
    • 积分:88
    • 等级:
    • 排名:千里之外
    • 原创:3篇
    • 转载:4篇
    • 译文:0篇
    • 评论:6条