从最新的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" />
Run Code Online (Sandbox Code Playgroud)
什么是"工具:上下文"用于?
它怎么知道写在那里的活动的确切路径?它是否在清单中查看应用程序的包?
它仅限于扩展Context或仅扩展活动的类吗?它可用于ListView项目等吗?
xml android android-context android-layout android-tools-namespace
我刚才知道我们可以使用工具设置文本:text ="toolsText".在此之前我使用的是android:text ="androidText".
请告诉我1.这两个特征之间有什么区别2.哪一个最好用.3在ui渲染过程中有什么影响
ADT现在生成具有以下属性的XML布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${packageName}.${activityClass}" >
Run Code Online (Sandbox Code Playgroud)
设计工具如何知道它属于哪个类?