【发布时间】:2012-06-20 03:58:12
【问题描述】:
从最近的新版本 ADT 开始,我注意到布局 XML 文件中的这个新属性,例如:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainActivity" />
什么是“工具:上下文”?
它甚至如何知道那里编写的活动的确切路径?它是否在清单中查看应用程序包?
它仅限于扩展 Context 的类还是仅限于活动?是否可用于 ListView 项目等?
【问题讨论】:
-
是的,我想知道我还错过了什么(没有在“新功能”部分看到),因为我总是安装最新的 adt&sdk 版本(当前使用 adt&sdk 20 预览版 3)。
-
另外,请在此处查看官方文档:tools.android.com/tech-docs/tools-attributes#TOC-tools:context>。
-
我的应用在没有上下文的情况下仍然可以工作。
-
@user132522 一切都与开发有关,在 IDE 本身中。不适用于运行应用程序时
标签: android xml android-layout android-context android-tools-namespace