Android基本组件是什么?

1ImageView继承View组件,不单单用于显示图片,用 XML代码 编写的Drawable也可以显示出来。
其中的XML属性 android:scaleType(设置图片如何缩放或移动以适应ImageView的大小) 有很多的属性值,如:matrix(使用矩形方式进行缩放)fitXY(对图片横向`纵向缩放)center(图片放在ImageView中间)等等…
下面是XML代码:<ImageViewandroid:id="@+id/imageView1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@+id/textView1"android:scaleType="fitCenter"android:src="@drawable/ic_launcher"android:layout_toRightOf="@+id/textView1" />

 

2、ImageButton,与前面讲的Button的区别在于Button生成的按钮上显示文字,而ImageButton显示图片,对它设置android:text属性是没用的。
下面是XML代码:使用android:src 自定义Drawable对象<ImageButtonandroid:id="@+id/imageButton1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:src="@drawable/button_selector" />补充:drawable的XML文件在前面的笔记(二)也有写过Android基本组件(笔记二)<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android" ><!– 指定按钮按下时的图片 –><item android:state_pressed="true"android:drawable="@drawable|d1"/><!– 指定按钮松开时的图片 –><item android:state_pressed="false"android:drawable="drawable|d2"/></selector>

 

3、ZoomButton代表“放大”,“缩小”两个按钮,android默认提供了btn_minus,btn_plus两个drawable资源。<ZoomButtonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:id="@+id/btn_zoom_down"android:src="@android:drawable/btn_minus" /><ZoomButtonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:id="@+id/btn_zoom_up"android:src="@android:drawable/btn_plus" />Android基本组件(三)

 

4、QuickContactBadge,继承了ImageView,可通过android src 添加图片。增加的额外功能是该图片可以关联到手机中指定的联系人,当用户点击该图片时系统将会打开相应联系人的联系方式界面。<QuickContactBadgeandroid:id="@+id/badge"android:layout_height="wrap_content"android:layout_width="wrap_content"android:src="@drawable/ic_launcher"/>


转载 - 编程知识

转载于:https://www.cnblogs.com/weiichuangwangxun/p/10032080.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/252920.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Java 运算符及优先级

运算符 分割符&#xff1a;  ,  ;  []  ()算数运算符&#xff1a;    -  *  /  %    --关系运算符&#xff1a;  >  <  >  <    !逻辑运算符&#xff1a;  !  &  |  ^  &&  ||赋值运算符&#xff1a; …

array sort - 2 : quick sort

递归实现&#xff1a; #include <stdio.h>int arr[10] {3, 2, 4, 1, 9, 7, 5, 6, 0, 8};void print_array(){ int i 0; for (i 0; i < 10; i) printf("arr[%d]:%d ", i, arr[i]); printf("\n");}void swap(int *i, int *j){ …

Linux C 读取文件夹下所有文件(包括子文件夹)的文件名

本文&#xff1a;http://www.cnblogs.com/xudong-bupt/p/3504442.html Linux C 下面读取文件夹要用到结构体struct dirent&#xff0c;在头#include <dirent.h>中&#xff0c;如下&#xff1a; #include <dirent.h> struct dirent {long d_ino; /* inode number 索…

报表工具实现单据套打

【摘要】 单据套打再也不用手动测量&#xff0c;反复调试了&#xff0c;报表工具实现单据套打&#xff0c;去乾学院看个究竟&#xff1a;报表工具实现单据套打!实际项目开发中&#xff0c;很多情况会涉及到单据的打印。即在一张印刷好的空白单据上&#xff0c;准确无误地打印上…

每隔10秒钟打印一个“Helloworld”

/*** 每隔10秒钟打印一个“Helloworld”*/ public class Test03 {public static void main(String[] args) throws InterruptedException {ThreadImp threadImp new ThreadImp();Thread thread1 new Thread(threadImp);thread1.start();} }class ThreadImp extends Thread {p…

C++ STL 优先队列

//优先队列//Priority_queue //STL#include<iostream>#include<cstdio>#include<cstdlib>#include<queue>using namespace std;struct cmp{ bool operator() (const int a,const int b) const{//用const定义的a,b是包裹着变量外衣的常数&#xff0c;不…

GDB调试core文件样例(如何定位Segment fault)

core dump又叫核心转储, 当程序运行过程中发生异常, 程序异常退出时, 由操作系统把程序当前的内存状况存储在一个core文件中, 叫core dump. (Linux中如果内存越界会收到SIGSEGV信号&#xff0c;然后就会core dump) 在程序运行的过程中&#xff0c;有的时候我们会遇到Segment fa…

管理信息系统的开发与管理

{% extendsmuban.html %} {% block head %}输入{% endblock %} {% block main %} <div><div class"form-group"><label for"question">标题</label><textarea class"form-control" cols"50" rows"2&q…

python11-28笔记(1.6-1.7)

1.6 多类型传值和冗余参数多类型传值&#xff1a;比如def fun(x,y)&#xff0c;定义2个形参定义一个元组t(1,2),如果把元组当做实参传入到函数中&#xff0c;会报错 如何将元组当做不同类型的参数传入到函数中fun(t) 代表传入的是元组或者这样调用fun((1,2))注意实参的个数要和…

session机制详解以及session的相关应用

session是web开发里一个重要的概念&#xff0c;在大多数web应用里session都是被当做现成的东西&#xff0c;拿来就直接用&#xff0c;但是一些复杂的web应用里能拿来用的session已经满足不了实际的需求&#xff0c;当碰到这样的情况时候我们需要更加深入的理解session的机制&am…

(转)Shell中获取字符串长度的七种方法

Shell中获取字符串长度的七种方法 原文&#xff1a;http://blog.csdn.net/jerry_1126/article/details/51835119 求字符串操作在shell脚本中很常用&#xff0c;下面归纳、汇总了求字符串的几种可能方法: 【方法一】:利用${#str}来获取字符串的长度 【方法二】:利用awk的length方…

linux下用core和gdb查询出现段错误的地方

有些时候我们在一段C代码的时候&#xff0c;由于对一个非法内存进行了操作&#xff0c;在程序运行的过程中&#xff0c;出现了"段错误"。呵呵&#xff0c;这种问题我想很多人会经常遇到。遇到这种问题是非常无语的&#xff0c;只是提示了"段错误"&#xff…

第一篇-Html标签中head标签,body标签中input系列,textarea和select标签

第十四周课程&#xff08;1-12章节&#xff09; HTML 裸体 CSS 穿华丽衣服 Javascript 动起来 一 HTML &#xff08;20个标签&#xff09; 1.我们的浏览器是socket客户端 2.一套规则&#xff0c;浏览器认识的规则 3.开发者&#xff1a; 学习html规则 开发后台程序&#xff1a…

opencv3.2.0 Cmake 3.8.0 + tdm-gcc-5.1.0-3

实测 tdm-gcc-5.1.0-3 tdm32-1 32位版本无法正确编译Opencv 3.2.0 会遇到诸多编译问题 解决办法 使用tdm-gcc-5.1.0-2 tdm64-1 64位版本转载于:https://www.cnblogs.com/fundou/p/6710209.html

什么是商品属性

一、什么是商品属性&#xff1a; Definition of Product Attributes A product attribute is a characteristic that defines a particular product and will affect a consumers purchase decision. Product attributes can be tangible (or physical in nature) or intangibl…

linux用户管理(1)----创建用户(adduser和useradd)和删除用户(userdel)

arm linux的系统用户管理&#xff1a; 1、删除root用户&#xff1a;deluser root2、删除tt用户:deluser tt3、建立root用户&#xff1a;adduser root4、修改用户密码&#xff1a;登录相应的用户后&#xff0c;用passwd来修改密码4、linux用户和密码的管理&#xff08;ftp&#…

前端性能优化之图像优化原理

前端性能优化中&#xff0c;图像的优化是非常重要的一环&#xff0c;为什么要说图像的优化呢&#xff0c;而不是我们常见的图片优化&#xff1f;因为这里的图像包括矢量图和位图&#xff0c;我们常说的图片优化是指位图的优化。这篇文章转载至奇舞周刊&#xff0c;大佬总结的非…

Lua开发学习4-普通循环和迭代器循环

说句实话&#xff0c;每当看到Lua代码&#xff0c;我都感觉是半个SQL代码&#xff0c;写起来还是感觉有点恐怖。 while循环&#xff1a; 与C#的while循环类似&#xff0c;没有什么好说的&#xff1b; --------Lua的while循环 while(condition)dostatementsend For循环 exp1为起…

什么是js的严格模式

设立严格模式的原因&#xff1a; - 消除Javascript语法的一些不合理、不严谨之处&#xff0c;减少一些怪异行为; - 消除代码运行的一些不安全之处&#xff0c;保证代码运行的安全&#xff1b; - 提高编译器效率&#xff0c;增加运行速度&#xff1b; - 为未来新版本的Javascrip…

Linux驱动设计ioctl函数的cmd参数不能为2

Linux驱动程序设计的时候偶然发现的ioctl()函数的cmd参数不能为2&#xff0c;如果为2,ioctl()函数返回-1&#xff0c;网上说就是这样的&#xff0c;正常&#xff0c;不知道为什么&#xff0c;stack overflow上有一个外国学友的建议&#xff1a; “In general, you want to comp…