ImageView

  ImageView是用来在界面上展示图片的一个控件。它可以让我们的界面变的丰富多彩。
它的使用很简单:

    <ImageView  android:id="@+id/imageview" android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/dog" android:scaleType="center" android:tint="#44ff0000"/>

添加图片

  通过属性`android:src=”@mipmap/dog”’来加载图片。

图片显示样式

  通过属性android:scaleType="center"来设置图片的显示样式,其中属性值有:center,fitXY,fitstart,fitend,centerCrop,centerInside等,大家可以自己每一个都测试一下,这里不再详述。

添加蒙版

  大家可能会想,什么是蒙版,我们来张图片对比一下就知道了。
  
添加蒙版前:

Android UI设计——ImageView和ImageButton控件_第1张图片

通过语句android:tint="#44ff0000"添加一个颜色为“#44ff0000”的蒙板:

Android UI设计——ImageView和ImageButton控件_第2张图片

ImagButton

  ImageButton的使用与ImageView的使用是相同的。唯一的区别就是:ImageButton添加图片后的背景是Button的背景,而ImageView的背景是空白的。

更多相关文章

  1. Android静态图片人脸识别的完整demo(附完整源码)
  2. android 获取http网络图片保存png
  3. Android中常用基本控件的使用方法和步骤(.txt)
  4. Android UI设计——ListView控件与SimpleAdapter适配器(三)
  5. 浅谈Android常用控件
  6. Android 样式开发(二)selector篇
  7. 在android中显示网络图片及查看页面源代码
  8. android之调用webservice实现图片上传
  9. ImageButton 和ImageWell 样式的浅析

随机推荐

  1. 如何从Android so中提取URL
  2. Android Accessibility(辅助功能) 安全相
  3. 波音787 Dreamliner娱乐系统将选择Androi
  4. Android中通过WebView控件实现与JavaScri
  5. Android Studio 单刷《第一行代码》系列
  6. Android生成签名文件并用其对apk文件进行
  7. Android模拟神器――Genymotion
  8. Android辅助功能AccessibilityService与
  9. 如何在MainActivity中使用ReactApplicati
  10. android开发笔记之2012版辅助开发工具包(A