Coloring the Space widget

As per the official docs definition:

Space is a lightweight View subclass that may be used to create gaps between components in general purpose layouts.

They probably didn't think of "coloring an empty space".
Where "empty" means "without color", "invisible".

That's what I'd do:

<View
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:background="@android:color/black"
/>

Using a bare View as a divider is one of my 2/3 favourite tricks with bare Views.
I also use them as spacers and as "center point" in RelativeLayouts.


I tried Paul's "view trick" but had GridLayout horizontal / vertical constraints problem (and during execution drawing stops as soon as this view is encountered). For me (Studio 2.3.3, api 21) this worked :

<TextView
        android:layout_width="4dp"
        android:layout_height="match_parent"
        android:layout_gravity="fill_vertical"
        android:background="@color/housetoolsBlue" />