I managed to get a frame with a header using the following technique.
Use FrameLayout for general layout.
Inside add another layout for your main content - it could be anything. For the background of this layout, use your own XML drawing with stroke to draw the frame. Remember to add fields to this layout, especially marginTop , since you need a place to display the frame title. Also add some indentation to make it more enjoyable.
Use a TextView with an opaque background and some paddings as a title. Set marginLeft valid value to offset the title on the left.
Here is my XML for this:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@android:color/white"> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margin="15dp" android:background="@drawable/frame" android:orientation="vertical" android:padding="20dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Main Content" android:layout_centerInParent="true" /> </RelativeLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:color/white" android:padding="5dp" android:text="Testing" android:layout_marginLeft="30dp" android:textColor="@android:color/black" /> </RelativeLayout>
On execution, I get this in the application:

Feel free to customize the fields / paddings to align the title as you need.
Aleks G
source share