首页 > 移动平台 > 详细

Android控件之Button(按钮控件)和ImageButton(图片按钮控件)

时间:2015-07-19 23:33:03      阅读:196      评论:0      收藏:0      [点我收藏+]

一、Button和ImageButton特证:

  1、共同特证:

    都可以作为一个按钮产生点击事件

  2、不同特证:

    Button有text的属性,ImageButton没有

    ImageButton有src属性,Button没有

 

 

 

 

二、布局文件中设置Button和ImageButton控件

  <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/login" />

    <Button
        android:id="@+id/button2"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/login"
        android:background="#ff00ff" />

    <ImageButton
        android:id="@+id/imageButton1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher" />
    
    <ImageButton
        android:id="@+id/imageButton1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/ic_launcher" />

 

Android控件之Button(按钮控件)和ImageButton(图片按钮控件)

原文:http://www.cnblogs.com/LO-ME/p/4659872.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!