Use layout editor effectively on layouts with non-static fragments

android, android-context, android-fragments, dynamic, graphical-layout-editor

Solution

It looks, according to the documentation for `FrameLayout`, like there is an attribute you can use on the `FrameLayout` tag to put a drawable in the foreground of the ViewGroup.

You could use this to see the FrameLayout whilst you are setting up your view. I often just put a colour in so I can see where it is relative to the background and other `View`s.

Problem

With all the Android development tools greatness, especially as of version 21, the graphical layout editor is a powerful tool to have visual control over a layout with fragments for every configuration and locale. I'm aware that a typical `Activity`'s layout XML will contain static `fragment` tags with info embedded for the layout editor, for example `tools:layout="@layout/book_collection_view_window_list"`. However, because I need to replace the `Fragments` in my window dynamically, I cannot use the static `fragment` tags, and instead need to provide containers, such as `FrameLayout`, to which I can refer in `replace()`. Is there something like `tools:layout` or `tools:context` I can use on this container so in the layout editor there is more than just black emptyness, and so I can leverage the design and verification features it would give me?

Original source