Attributes Layout
来源:互联网 发布:手机美发软件 编辑:程序博客网 时间:2024/04/30 13:18
http://developer.android.com/guide/topics/ui/declaring-layout.html
属性
每个View和ViewGroup对象支持他们自己的各种XML属性。有些属性是具体 到一个视图对象(例如,TextView的支持的TEXTSIZE
属性),但也可能扩展这个类的任何视图对象继承这些属性。有些是共同所有的视图对象,因为它们是从根View类继承(如id 属性的)。以及其他属性被认为是“布局参数”,这是描述View对象的某些布局方向,由该对象的父ViewGroup对象定义的属性。
ID
任何视图对象可能有一个与它相关的整数ID,唯一标识在树视图。编译应用程序时,这个ID被引用为一个整数,但布局XML文件作为一个字符串的ID通常分配在id
属性。这是一个XML的属性共同所有的视图对象(由定义视图
类),你会经常使用它。XML标签内,一个ID的语法是:
android:id="@+id/my_button"
在符号(@)开头的字符串表示,XML解析器解析和扩展的ID字符串的其余部分,并确定它作为一个ID资源。加号(+)表示,这是一个新的资源名称,必须建立并加入到我们的资源(R.java
文件)。也有一些其他ID是Android框架提供资源。当引用一个Android资源ID,你并不需要+的符号,but must add the android
package namespace, like so:
android:id="@android:id/empty"
随着Android
到位的包命名空间,我们现在引用从android.R
资源类的ID ,而不是当地的资源类。
In order to create views and reference them from the application, a common pattern is to:
- 在布局文件中定义的视图/部件和为它分配一个唯一的ID:
<Button android:id="@+id/my_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/my_button_text"/>
- 然后创建一个视图对象的实例,并从布局(通常在捕捉它
方法):的onCreate()
Button myButton = (Button) findViewById(R.id.my_button);
定义视图对象的ID是非常重要的,当创建一个RelativeLayout
。 In a relative layout, sibling views can define their layout relative to another sibling view, which is referenced by the unique ID.
一个ID,need not be unique throughout the entire tree,它应该是独一无二的。
- Attributes Layout
- Android - Designtime Layout Attributes & Tools Attributes
- 'NSInternalInconsistencyException', reason: 'UICollectionView received layout attributes for a ...
- Attributes
- Attributes
- $$Attributes
- UICollectionView recieved layout attributes for a cell with an index path that does not exist 解决办法
- Layout
- Layout
- layout
- layout
- layout
- layout
- Layout
- layout
- layout
- layout
- layout
- MSSOAP30.DLL VC 报错问题 MSSOAP30.DLL 3.0下载 MSSOAP30.DLL 3.0.1325.0 vc xp
- 根据进程令牌来完成计算机之间文件拷贝
- Vtune how to use?
- 无
- 史前被踩之最→貼子! ~...~
- Attributes Layout
- 关于学习Linux的经典书籍 (深入理解Linux内核、Linux设备驱动程序等)
- amplxe-cl -finalize:用的不多.
- 面向对象的设计原则-类设计原则
- MyGUI 功能与架构
- vtune import:用的不多.
- char, wchar_t, TCHAR 字符全总结 & c++字符串操作经验集
- vtune report
- 获取iOS设备的内存状况