Android ApiDemos示例解析(105):Views->Buttons
来源:互联网 发布:淘宝主图要求规范 编辑:程序博客网 时间:2024/06/11 08:07
Buttons 示例介绍了定义Button,ToggleButton的基本方法。本例在/res/layout/buttons_1.xml 定义如下:
<!– Regular sized buttons –>
<Button android:id=”@+id/button_normal”
android:text=”@string/buttons_1_normal”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content” />
<!– Small buttons –>
<Button android:id=”@+id/button_small”
style=”?android:attr/buttonStyleSmall”
android:text=”@string/buttons_1_small”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content” />
<ToggleButton android:id=”@+id/button_toggle”
android:text=”@string/buttons_1_toggle”
android:textOn=”Open”
android:textOff=”Close”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content” />
定义button 不指定任何风格时,Android以正常大小显示Button,
风格 ?android:attr/buttonStyleSmall 以紧凑风格显示Button。
在引用Style 属性值时, 使用“?” 而非”@” 来指定所需风格属性,格式如下:
?[<package_name>:][<resource_type>/]<resource_name>
其中resource_type部分可选,因此 本例也可以使用如下定义:
style=”?android:buttonStyleSmall”
ToggleButton 使用button 形式定义两种状态,比如Open,Close。缺省文本为ON, OFF, 可以使用属性textOn,textOff 重新定义文字。
- Android ApiDemos示例解析(105):Views->Buttons
- Android ApiDemos示例解析(106):Views->Chronometer
- Android ApiDemos示例解析(109):Views->Custom
- Android ApiDemos示例解析(109):Views->Custom
- Android ApiDemos示例解析(123):Views->ImageButton
- Android ApiDemos示例解析(124):Views->ImageSwitcher
- Android ApiDemos示例解析(125):Views->ImageView
- Android ApiDemos示例解析(192):Views->Spinner
- Android ApiDemos示例解析(196):Views->TextSwitcher
- Android ApiDemos示例解析(197):Views->Visibility
- Android ApiDemos示例解析(198):Views->WebView
- Android ApiDemos示例解析(109):Views->Custom
- Android ApiDemos示例解析(95):Views->Animation->3D Transition
- Android ApiDemos示例解析(96):Views->Animation->Interpolators
- Android ApiDemos示例解析(97):Views->Animation->Push
- Android ApiDemos示例解析(98):Views->Animation->Shake
- Android ApiDemos示例解析(101):Views->Auto Complete->3. Scroll
- Android ApiDemos示例解析(102):Views->Auto Complete->4. Contacts
- sqlite3中的数据类型
- broken necklace
- Comparator和Comparable在排序中的应用
- 笔划输入法查找算法示例(Lua实现)
- eas bos 导入解决方案后,启动报错org.eclipse.core.runtime.CoreException
- Android ApiDemos示例解析(105):Views->Buttons
- 舵机光敏电阻实现一维光源追踪
- Vaadin Web应用开发教程(6):使用资源
- /dev/null 2>&1 详解
- VC用法汇总
- 关于断点的一些知识
- VC控件使用( Tab Control等)
- 一个修改桌面背景色的例子
- PHP学习笔记-数组