Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7569161
  • 博文数量: 961
  • 博客积分: 15795
  • 博客等级: 上将
  • 技术积分: 16612
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-07 14:23
文章分类

全部博文(961)

文章存档

2016年(1)

2015年(61)

2014年(41)

2013年(51)

2012年(235)

2011年(391)

2010年(181)

分类: Android平台

2015-11-18 09:41:20

    与按钮组件(Button)类似,在Android中又提供了一个图片按钮,可以直接使用ImageButton定义

点击(此处)折叠或打开

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout                     ?    定义线型布局管理器
  3.     xmlns:android=""
  4.     android:orientation="vertical"             ?    所有组件垂直摆放
  5.     android:layout_width="fill_parent"            ?    布局管理器宽度为屏幕宽度
  6.     android:layout_height="fill_parent">        ?    布局管理器高度为屏幕高度
  7.     <ImageButton                    ?    定义图片按钮组件
  8.         android:id="@+id/rig"            ?    此组件的ID,程序中使用
  9.         android:src="@drawable/right"            ?    显示的图片ID
  10.         android:layout_width="wrap_content"        ?    组件宽度为图片宽度
  11.         android:layout_height="wrap_content" />        ?    组件宽度为图片高度
  12.     <ImageButton                    ?    定义图片按钮组件
  13.         android:id="@+id/wro"            ?    此组件的ID,程序中使用
  14.         android:src="@drawable/wrong"            ?    显示的图片ID
  15.         android:layout_width="wrap_content"        ?    组件宽度为图片宽度
  16.         android:layout_height="wrap_content" />        ?    组件宽度为图片高度
  17. </LinearLayout>

020409_图片按钮:ImageButton.ppt

阅读(1038) | 评论(0) | 转发(0) |
0

上一篇:ImageView组件

下一篇:时间选择器:TimePicker

给主人留下些什么吧!~~