OK, this how I made a layout which is very similar to the one you asked for, just using layouts instead of code ;)
The results:
(240*320 ldpi screen)
(320*480 mdpi screen)
The images I used:
(the red line, res/drawable/line_hor_red)
(the invisible line in the center, res/drawable/line_hor_tsp)
The next two LOOK identical, but aren't
(horizontal dotted pattern, res/drawable/ptn_hor_blk)
(vertical dotted pattern, res/drawable/ptn_ver_blk)
Now that you have to put your images in res/drawable (or in res/drawable-mdpi - which is the NORMAL resolution, and it will be scaled to fit all others), do this:
Put in your res/drawable folder these two layouts:
dots_hor:
<?xml version="1.0" encoding="utf-8"?>
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ptn_hor_blk"
android:tileMode="repeat"
/>
dots_ver:
<?xml version="1.0" encoding="utf-8"?>
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ptn_ver_blk"
android:tileMode="repeat"
/>
This is the layout you want (background.xml)
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:background="#fff"
android:orientation="vertical"
>
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/dots_hor"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:background="@drawable/dots_ver"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:background="#0000"
android:orientation="vertical"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:src="@drawable/line_hor_red"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:src="@drawable/line_hor_red"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:src="@drawable/line_hor_tsp"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:src="@drawable/line_hor_red"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:src="@drawable/line_hor_red"
/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
[EDIT]
ALTERNATIVE LAYOUT, WITHOUT THE DOTS
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:background="#fff"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:background="#0000"
android:orientation="vertical"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:src="@drawable/line_hor_red"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:src="@drawable/line_hor_red"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:src="@drawable/line_hor_tsp"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:src="@drawable/line_hor_red"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:src="@drawable/line_hor_red"
/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
This means that you don't need drawable/dots_hor, drawable/dots_ver, drawable/ptn_hor_blk, drawable/ptn_ver_blk
[/EDIT]
What you will need in your MainActivity:
import android.view.Window;
import android.view.WindowManager;
And
@Override
protected void onCreate(
final Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// Make this activity, full screen
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
// Hide the Title bar of this activity screen
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.background);
}
Last but not least, if I helped you, don't forget to accept my answer and upvote.