android 入门-android属性介绍
android:visibility="gone" 不保留view控件所占有的空间 隐藏
android:visibility="invisible" 保留了view控件所占有的空间 不可见
android:visibility="visible" 保留了view控件所占有的空间 可见
显隐
android:drawable 放一个drawable资源
android:state_pressed 是否按下,如一个按钮触摸或者点击。
android:state_focused 是否取得焦点,比如用户选择了一个文本框。
android:state_hovered 光标是否悬停,通常与focused state相同,它是4.0的新特性
android:state_selected 被选中,它与focus state并不完全一样,如一个list view 被选中的时候,它里面的各个子组件可能通过方向键,被选中了。
android:state_checkable 组件是否能被check。如:RadioButton是可以被check的。
android:state_checked 被checked了,如:一个RadioButton可以被check了。
android:state_enabled 能够接受触摸或者点击事件
android:state_activated 被激活(这个麻烦举个例子,不是特明白)
android:state_window_focused 应用程序是否在前台,当有通知栏被拉下来或者一个对话框弹出的时候应用程序就不在前台了
drawable属性
android:singleLine 设置单行显示。 如果和layout_width一起使用,当文本不能全部显示时,后面用“…”来表示。如 android:text="test_ singleLine " android:singleLine="true" android:layout_width="20dp"将只显示“t…”。如果不设置singleLine或者设置为false,文本将自动换行 android:ellipsize="start" 省略号在开头 android:ellipsize="middle" 省略号在中间 android:ellipsize="end" 省略号在结尾 android:ellipsize="marquee" 跑马灯显示
单行 省略
android:duplicateParentState
就是父控件响应点击事件,子View不响应点击事件,但是颜色要随着点击而发生变化。这样就用到了属性duplicateParentState。 ”如果设置此属性,将直接从父容器中获取绘图状态(光标,按下等)。 注意仅仅是获取绘图状态,而没有获取事件,也就是你点一下LinearLayout时Button有被点击的效果,但是不执行点击事件“
duplicateParentState
android:layout_above="@id/xxx" --将控件置于给定ID控件之上
android:layout_below="@id/xxx" --将控件置于给定ID控件之下 android:layout_toLeftOf="@id/xxx" --将控件的右边缘和给定ID控件的左边缘对齐
android:layout_toRightOf="@id/xxx" --将控件的左边缘和给定ID控件的右边缘对齐 android:layout_alignLeft="@id/xxx" --将控件的左边缘和给定ID控件的左边缘对齐
android:layout_alignTop="@id/xxx" --将控件的上边缘和给定ID控件的上边缘对齐
android:layout_alignRight="@id/xxx" --将控件的右边缘和给定ID控件的右边缘对齐
android:layout_alignBottom="@id/xxx" --将控件的底边缘和给定ID控件的底边缘对齐
android:layout_alignParentLeft="true" --将控件的左边缘和父控件的左边缘对齐
android:layout_alignParentTop="true" --将控件的上边缘和父控件的上边缘对齐
android:layout_alignParentRight="true" --将控件的右边缘和父控件的右边缘对齐
android:layout_alignParentBottom="true" --将控件的底边缘和父控件的底边缘对齐
android:layout_centerInParent="true" --将控件置于父控件的中心位置
android:layout_centerHorizontal="true" --将控件置于水平方向的中心位置
android:layout_centerVertical="true" --将控件置于垂直方向的中心位置
RelativeLayout各个属性的含义
android:insetTop:图像距离上边的距离。 android:insetRight:图像距离右侧的距离。 android:insetBottom:图像距离底边的距离。 android:insetLeft:图像距离左侧的距离。
inset
android 入门-android属性介绍的更多相关文章
- android 入门-工程属性介绍
工程属性 (1)drawable-hdpi里面存放高分辨率的图片,如WVGA (480x800),FWVGA (480x854) (2)drawable-mdpi里面存放中等分辨率的图片,如HVGA ...
- android 入门-android Studio git 克隆
最后是完成 以上是如何从android studio Git 克隆Github的项目
- android 入门-android自定义控件
第一种:继承View 实现自己的属性 <com.cc.imagewithmarkersample.MyView android:id="@+id/myviewid" andr ...
- android 入门-android Studio 解决方案
一.当提示 解决方案: 1. 2. 二.从这步到这步 的时候,可能遇见下面的问题. 解决方案: 更新一下build-tools 19.1.0版本 放到你的sdk里并重启as. 三. 当遇见这样的情况 ...
- android 入门-android Studio 配置
重要:sdk 最好先有一个版本 19版本.build-tools 19.1.0 extras 19.0和platforms android-19 1.下载android sdk 和jdk 并配置环境变 ...
- android 入门-android Studio 快捷输入
1.输入 log的时候按一下Tab.就会打出 private static final String TAG="Settings"; 2. shift +alt+x 运行 shif ...
- android 入门-android Studio git配置
以后在整理
- UniMelb Comp30022 IT Project (Capstone) - 1.Android入门
1. Android入门 Android系统架构 Android系统:四层架构.五块区域 1. Linux内核层 Linux Kernel:为Android设备的硬件提供了底层驱动 2. 系统运行库层 ...
- Android入门(十二)SQLite事务、升级数据库
原文链接:http://www.orlion.ga/610/ 一.事务 SQLite支持事务,看一下Android如何使用事务:比如 Book表中的数据都已经很老了,现在准备全部废弃掉替换成新数据,可 ...
随机推荐
- PyQt4 QListview控件使用方法
1.往QListView控件内写入数据 strlist=QStringList()strlist.append('hello')strm=QStringListModel(strlist)self.u ...
- ubuntu下查找某个文件的路径
参考:ubuntu下如何查找某个文件的路径 http://blog.csdn.net/lieyanhaipo/article/details/17055667 在Ubuntu有时候会遇到记得 ...
- C#之枚举类型
参考: http://www.cnblogs.com/an-wl/archive/2011/04/14/2015815.html 惯例先上MSDN: https://msdn.microsoft.co ...
- Mathematics:Find a multiple(POJ 2356)
找组合 题目大意:给你N个自然数,请你求出若干个数的组合的和为N的整数倍的数 经典鸽巢原理题目,鸽巢原理的意思是,有N个物品,放在N-1个集合中,则一定存在一个集合有2个元素或以上. 这一题是说有找出 ...
- SQL键值约束、索引使用
添加約束的方式: [exec sp_helpconstraint 表名]->可用于查找到表创建的约束 CREATE TABLE stuInfo ( stuName ) NOT NULL,非空約束 ...
- Android Multimedia框架总结(二)MediaPlayer框架及播放网络视频案例
前言:前面一篇我们介绍MediaPlayer相关方法,有人说,没有实际例子,看得不是很明白,今天在分析MediaPlayer时,顺带一个播放网络视频例子.可以自行试试.今天分析的都是下几篇介绍各个模块 ...
- Windows update 失败的解决方案
由于刚刚装了新的系统,结果在电脑用了刚刚一周之后,我打开了自动更新,结果电脑就一直处于更新状态中.期初我以为是更新比较慢,等等可能就结束了,结果等了足足一晚上,到了第二天,电脑显示是:配置更新失败,正 ...
- 【leetcode】 Letter Combinations of a Phone Number(middle)
Given a digit string, return all possible letter combinations that the number could represent. A map ...
- 【el表达式】jsp中设置默认图像
<img alt="头像" src="${empty members.headPic ?'images/icon.png':members.headPic}&quo ...
- Alcatraz安装在xcode7失败执行下面代码
1.步奏rm -rf ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin 2.步奏 rm ...