ADT20.0,新建Android Application Project:

默认的布局文件内容变化了:
LinearLayout变成了RelativeLayout:
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/padding_medium"
android:text="@string/hello_world"
android:textSize="18sp"
tools:context=".MainActivity"/>

还多了个新的namespace和相应的属性,这个属性的作用是什么呢?解释如下:

请各自选择相应语种,对号入座,O(∩_∩)O~

English Original Explaination:

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: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的样子。仅用于给你看所见即所得的效果而已。

原文连接:点击打开链接

更多相关文章

  1. Android下Dialog及Activity屏蔽Home键详解
  2. GitHub 优秀的 Android(安卓)开源项目
  3. Android中给图片加边框
  4. gradle-xxx.jar下载地址和gradle-xxx.zip下载地址
  5. android 设置 永不休眠
  6. android字体设置
  7. 自定义组件研究
  8. Android(安卓)PopWindow使用
  9. gallery 显示文字

随机推荐

  1. Android设备开机后自动启动APP解决方法:(
  2. android的文件存储
  3. sd卡插拔广播
  4. android项目 编译出现"Unsupported major
  5. Android程序的入口
  6. Android初学者冷知识
  7. Android(安卓)ViewTreeObserver简介
  8. Android studio cmd命令行操作数据库文件
  9. Android Service Manager分析
  10. Android防注入研究