Android studio 3.0命名空间启用设计时功能(例如,在片段中显示哪个布局)或编译时行为(例如应用于XML资源的缩小模式) 这是一个非常强大的功能,正在开发并允许您不必每次都编译代码来查看更改
GridLayoutManager示例
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:itemCount="5"
tools:layoutManager="android.support.v7.widget.GridLayoutManager"
tools:listitem="@layout/item_video"
tools:orientation="horizontal"
tools:scrollbars="horizontal"
tools:spanCount="2" />
Android studio 3.0中引入的另一个很酷的功能是通过工具属性预定义数据,使用tools:text="@tools:sample/last_names"轻松可视化您的布局结构。例如,您的预览看起来像
请在这里阅读更多 -
[https://developer.android.com/studio/write/tool-attributes.html]
[https://youtu.be/Hx_rwS1NTiI?list=PLWz5rJ2EKKc-odHd6XEaf7ykfsosYyCKp&t=408]
[https://android.jlelse.eu/android-tools-attributes-listitem-sample-data-rocks-bbf49aaa9f07]