android中ImageView、ImageButton、Button之间的区别
2013-06-14 10:59
537 查看
1.继承不同:
java.lang.Object -> android.view.View -> android.widget.ImageView -> android.widget.ImageButton
java.lang.Object -> android.view.View -> android.widget.TextView -> android.widget.Button
因而ImageButton 不支持setText,而Button支持。反之,ImageButton 支持setImageURI,而Button不支持。Button和ImageButton有Button的状态,但是ImageView没有。
2.显示差异:
imageView 加上可点击的属性同样实现button的点击功能,这样看来没啥区别,可是可是,最近我做的listView,一个imagebutton,一个imageView 显示圆角图片的时候,imageBotton 居然显示不出来.
ImageButton 拥有默认背景:
去除ImageButton默认背景的方法:
引文:
http://blog.csdn.net/zapzqc/article/details/8497210
http://www.androidlearner.net/android-delete-whiteframe-imagebutton.html
java.lang.Object -> android.view.View -> android.widget.ImageView -> android.widget.ImageButton
java.lang.Object -> android.view.View -> android.widget.TextView -> android.widget.Button
因而ImageButton 不支持setText,而Button支持。反之,ImageButton 支持setImageURI,而Button不支持。Button和ImageButton有Button的状态,但是ImageView没有。
2.显示差异:
imageView 加上可点击的属性同样实现button的点击功能,这样看来没啥区别,可是可是,最近我做的listView,一个imagebutton,一个imageView 显示圆角图片的时候,imageBotton 居然显示不出来.
ImageButton 拥有默认背景:
<style name="Widget.ImageButton"> <item name="android:focusable">true</item> <item name="android:clickable">true</item> <item name="android:scaleType">center</item> <item name="android:background">@android:drawable/btn_default</item> </style>
去除ImageButton默认背景的方法:
<!-- layout_width和layout_height属性必须是wrap_content,否则边框还是会显示 --> <ImageButton android:id="@+id/ibLogin" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/btn_login" android:adjustViewBounds="true" android:padding="0dp" />
引文:
http://blog.csdn.net/zapzqc/article/details/8497210
http://www.androidlearner.net/android-delete-whiteframe-imagebutton.html
相关文章推荐
- Android中ImageView、ImageButton、Button之间的区别
- android中ImageView、ImageButton、Button之间的区别
- android中ImageView、ImageButton、Button之间的区别
- android中ImageView、ImageButton、Button之间的区别
- Android中Button,ImageButton,ImageView之间的区别
- android中ImageView、ImageButton、Button之间的区别
- 系出名门Android(5) - 控件(View)之TextView, Button, ImageButton, ImageView, CheckBox
- 系出名门Android(5) - 控件(View)之TextView, Button, ImageButton, ImageView, CheckBox, RadioButton, AnalogClock, DigitalClock
- android中imageView属性src,background和scaleType之间的区别
- android:ImageView 和ImageButton的区别
- 系出名门Android(5) – 控件(View)之TextView, Button, ImageButton, ImageView, CheckBox
- Android控件(View)之TextView, Button, ImageButton, ImageView, CheckBox 简单介绍
- 系出名门Android(5) - 控件(View)之TextView, Button, ImageButton, ImageView, CheckBox, RadioButton, AnalogClock, DigitalClock
- Android - 控件(View)之TextView, Button, ImageButton, ImageView, CheckBox, RadioButton, AnalogClock, DigitalClock 的简单介绍
- Android学习指南之九:Button、TextView、EditView、CheckBox、RadioGroup、ImageView、ImageButton
- 系出名门Android(5) - 控件(View)之TextView, Button, ImageButton, ImageView, CheckBox
- Android - 控件(View)之TextView, Button, ImageButton, ImageView, CheckBox
- Android ImageView,ImageButton 与 Button
- Android控件——TextView、EditText、ImageView、Button、ImageButton
- android:ImageView 和ImageButton的区别