1.描述
tools: context = "activity name" it won't be packaged into the apk .Only ADT Layout Editor in your current Layout file set corresponding rendering context, show your current Layout in rendering the context is the activity name corresponds to the activity, if the activity in the manifest file set a Theme, then ADT Layout Editor will render your current Layout according to the Theme.Means that if you set the MainActivity set a Theme. The Light (the other), then you see in visual layout manager o background control of what should be the Theme. The Light looks like.Only to show you what you see is what you get results.
有的人看了会懂一些,有的人看了也不知道,我再加几句解释:
2.样本
以简单的工具:文字为例,多一些图像,方便进一步了解的工具:上下文
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="sample name1" />
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="sample name2" />
TextView1采用了android: text,并使用工具:text在TextView2中,在布局编辑器的右侧会显示样本name1、样本name2两种字体,如果在运行代码编译后,生成apk,终端只显示样本name1,不显示样本name2的文字。你可以试试跑,看看效果如何。
3.具体的描述
1.这些工具:context = "activity name"它不会被打包到apk中(理解:相当于这个是注释的,编译后没有效果。)
2.Only ADT Layout Editor (i.e., for the above icon on the right side of the simulator) in the current Layout file set corresponding rendering context, the Layout of the current XML in rendering the context is the activity name corresponds to the activity, if the activity in the manifest file set a Theme, then ADT Layout Editor will render your current Layout according to the Theme.Means that if you set the MainActivity set a Theme. The Light can also be (other).(understand: you added tools: context = "activity name", the XML layout is rendering specified activity, establishes a Theme in the manifest file, pictured above right simulator Theme style will also follow changes corresponding to the Theme.)
4.总结
综上所述,以上这些属性主要针对正确的工具,模拟器调试时间显示状态,以及编译不工作,