从最近新版本的 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" />
“tools:context”是做什么用的?
它怎么知道写在那里的活动的确切路径?它会查看清单中的应用程序包吗?
它仅限于扩展 Context 的类还是仅限于活动?它可用于 ListView 项目等吗?
原文由 android developer 发布,翻译遵循 CC BY-SA 4.0 许可协议
这是工具 UI 编辑器用来呈现布局预览的活动。它记录 在这里: