zoukankan      html  css  js  c++  java
  • android中关于tools:context="activity name"解惑

    关于tools:context="activity name"有一段英文说明如下:

    One more thing: The "tools" namespace is special. The android packaging tool knows to ignore it, so none of those attributes will be packaged into the APK. We're using it for extra metadata in the layout. It's also where for example the attributes to suppress lint warnings are stored -- as tools:ignore.

    翻译:

    还有一件事:这个“Tools”的命名空间是特殊的。这个Android打包工具能够忽略它,因此这些属性没有被打包到APK当中。我们在布局文件中用它来修饰额外的元数据(

    元数据被定义为:描述数据及其环境的数据)。它也被用在其他地方,比如用这些属性来抑制lint(lint是最著名的C语言工具之一,一般由UNIX系统提供。)所产生的警告的存储等(它就像这个lint工具一样,可被忽略)
     
     
    通俗地理解为:
    tools:context="activity name"这一句不会被打包进APK。只是ADT的Layout Editor在你当前的Layout文件里面设置对应的渲染上下文,说明你当前的Layout所在的渲染上下文是activity name对应的那个activity,如果这个activity在manifest文件中设置了Theme,那么ADT的Layout Editor会根据这个Theme来渲染你当前的Layout。就是说如果你的MainActivity设置了一个Theme.Light(其他的也可 以),那么你在可视化布局管理器里面看到的背景、控件等就应该是Theme.Light的样子。仅用于给你呈现出看所见即所得的效果而已。
     
  • 相关阅读:
    计算机三级数据库-指导
    spring导入约束
    hibernater获取session时org.hibernate.service.spi.ServiceException错误
    springxml配置注入报错
    右键复制类的完整路径
    关于实体里的toString方法
    idea创建web项目环境
    框架快速找类
    如何在scdn博客里搜索自己博客文章
    永久消除自动产生的QQPCMgr
  • 原文地址:https://www.cnblogs.com/fly-allblue/p/3384195.html
Copyright © 2011-2022 走看看