下载此文档

Android起航 毕业论文外文翻译.docx


文档分类:外语学习 | 页数:约32页 举报非法文档有奖
1/32
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/32 下载此文档
文档列表 文档介绍
外文原文 Beginning Android Mark L. Murphy write Using XML-Based Layouts W hile it is technically possible to create and attach widgets toour activity purely through Java code, the way we did in Chapter 4, the mon approach is to use an XML-based layout file. Dynamic instantiation of widgets is reserved for plicated scenarios, where the widgets are not known pile-time (e g., populating a column of radio buttons based on data retrieved off the ). With that in mind, it’s time to break out the XML and learn how to lay out Android activities that way. What Is an XML-Based Layout? As the name suggests, an XML-based layout isa specification of widgets ’ relationships to each other — and to their containers (more on this in Chapter 7)— encoded in XML format. Specifi cally, Android considers XML-based layouts to be resources, and as such layout files are stored in the res/layout directory inside your Android project. Each XML file contains a tree of elements specifying a layout of widgets and their containers that make up one view hierarchy. The attributes of the XML elements are properties, describing how a widget should look or how a container should behave. For example, ifa Button element has an attribute value of android:textStyle = "bold", that means that the text appearing on the face of the button should be rendered ina boldface font style. Android ’s SDK ships with a tool (aapt) which uses the layouts. This tool should be automatically invoked by your Android tool chain (., Eclipse, Ant ’s ). Of particular importance to you asa developer is that aapt generates the source file within your project, allowing you to access layouts and widgets within those layouts directly from your Java code. Why Use XML-Based Layouts ? Most everything you do using XML layout files can be achieved through Java code. For example, you could use setTypeface() to have a button render its text in bold, instead of using a property in an XML layout. Since XML layouts are yet anoth

Android起航 毕业论文外文翻译 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数32
  • 收藏数0 收藏
  • 顶次数0
  • 上传人酒酿小樱桃
  • 文件大小0 KB
  • 时间2016-06-04