Skip to main content
1 of 10
yoAlex5
  • 35.2k
  • 10
  • 235
  • 253

tools namespace enables design-time features (such as which layout to show in a fragment) or compile-time behaviors (such as which shrinking mode to apply to your XML resources) It is really powerful feature that is developing and allows you not compile code every time to see changes

From Android studio 3.0 you can predefine data through the tools attributes, to visualized easily your layout structure using tools:text="@tools:sample/last_names"

Example with GridLayoutManager

<android.support.v7.widget.RecyclerView 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:layoutManager="android.support.v7.widget.GridLayoutManager" tools:listitem="@layout/test_item" tools:itemCount="3" tools:spanCount="2" /> 

Please read more here -
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

yoAlex5
  • 35.2k
  • 10
  • 235
  • 253