What's tools:layout in fragment xml file? What's tools:layout in fragment xml file? android android

What's tools:layout in fragment xml file?


This is a namespace used by the IDE tools. This is not needed to run the application on a device (or emulator). On the other hand, if you leave them, Android will ignore them when the application is running on a device.

This is used by e.g. lint and graphical layout tab.

You can check how it's used by lint here: http://developer.android.com/tools/debugging/improving-w-lint.html in section Configuring lint checking in XML.


Yes, it's just information for the Graphical Layout editor how the fragment should be displayed in the editor.

Generally the tools attributes (with tools namespace prefix declared with xmlns:tools="http://schemas.android.com/tools") are used by the development tools and are not compiled in the application itself.


right click on the grey area, " fragment layout->choose layout" and select your layout , DONE!