<!-- 知识点汇总:1、Button与ImageButton的区别在于,Button生成的按钮上显示文字而ImageButton上则显示图片。需要指出的是:为ImageButton按 钮指定android:text属性没用(ImageButton的本质是ImageView),即使指定了该属性,图片按钮上也不会显示任何文字2、ImageButton 派生了一个ZoomButton ,ZoomButton可以代表“放大”、"缩小"两个按钮。ZoomButton的行为基本类似于Imagebutton,只是Android默认提供了btn_minus、btn_plus两个Drawable资源,只要为ZoomButton的android:src属性分别指定btn_minus、btn_plus,即可实现"放大",“缩小”按钮3、Android中还提供了一个ZoomControls组件,该组件相当于同时组合了“放大”、“缩小”两个按钮,并允许分别为两个按钮绑定不同的事件 --><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical"    >    <!-- 普通图片按钮 -->    <ImageButton         android:layout_width="80dp"        android:layout_height="80dp"        android:src="@drawable/blue"        />    <!-- 按下时显示不同图片的按钮 -->    <ImageButton         android:layout_width="80dp"        android:layout_height="80dp"        android:src="@drawable/button_selector"        />    <LinearLayout         android:orientation="horizontal"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_margin="10sp"        android:layout_gravity="center_horizontal"        >        <!-- 分别定义2个ZoomButton,并分别似乎用btn_minus和btn_plus图片 -->        <ZoomButton             android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:id="@+id/btn_zoom_down"            android:src="@android:drawable/btn_minus"            />        <ZoomButton             android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:id="@+id/btn_zoom_up"            android:src="@android:drawable/btn_plus"            />    </LinearLayout>    <!-- 定义ZoomControls组件 -->   <ZoomControls        android:id="@+id/zoomControls1"       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:layout_gravity="center_horizontal"       /></LinearLayout>

显示效果


转载请注明出处:http://blog.csdn.net/android_jiangjun/article/details/25341727


更多相关文章

  1. android 登陆右上角 的关闭按钮的使用方法
  2. android点击实现图片放大缩小
  3. android 之RadioButton单选控件
  4. android imageUtil
  5. Android中图片实现按钮点击效果
  6. android:layout_marginLeft指该控件距离边父控件的边距, android:
  7. android自定义带图片的title
  8. Android(安卓)ApiDemos示例解析(139):Views->Layouts->Baseline-
  9. Android――ImageButton按下效果设计

随机推荐

  1. Oracle 删除用户和表空间详细介绍
  2. SQLServer数据库从高版本降级到低版本实
  3. Ubuntu 下安装SQL Server教程
  4. SQL判断语句用法和多表查询
  5. SQLServer获取临时表所有列名或是否存在
  6. Sql Server中Substring函数的用法实例解
  7. Mysql数据库性能优化三(分表、增量备份、
  8. SQL where条件和jion on条件的详解及区
  9. SQL 多条件查询几种实现方法详细介绍
  10. SQL Server附加数据库报错无法打开物理文