根据这里的问题,
'tools' 命名空间引用 (xmlns:tools="http://schemas.android.com/tools") 最近开始出现在我的布局中,我想了解更多。原始帖子仅描述了“工具:上下文”属性,但我也注意到当我为列表视图指定预览布局项时出现“工具:列表项”属性的用法,即
<ListView
android:id="@+id/lvCustomer"
tools:listitem="@layout/customer_list_item" >
</ListView>
还有更多元素吗?
将我带到这个“工具”命名空间的原因是,在 Eclipse 中使用布局设计器时,我希望能够拥有“仅预览”文本(即在 TextView 或 EditText 中)。
目前,我在安排布局时分配“文本”或“提示”属性来预览文本......但我总是必须记住从代码中清除预览值。
理想情况下,而不是
<string name="preview_customer_name">Billy Bob's Roadhouse Pub</string>
...
<TextView
android:id="@+id/tvCustomerName"
android:text="@string/preview_customer_name"
</TextView>
有一个类似的东西:
<TextView
android:id="@+id/tvCustomerName"
tools:previewText="@string/preview_customer_name"
</TextView>
谢谢-