Android 2D Game Architecture
<p>I am creating a 2d puzzle game on android and want to get the community's input on a design decision. The basic design is this. There is a SurfaceView one which the 2d graphics are drawn in a background thread. Then I also have a RelativeLayout that overlays the surface view. The layout .xml looks like this:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center" &gt;
&lt;SurfaceView
    android:id="@+id/game_surface"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" /&gt;
&lt;RelativeLayout
    android:id="@+id/game_overlay"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" /&gt;
&lt;/RelativeLayout&gt;
</code></pre>

<p>All touch events will be received by the game_overlay and will be routed to the game thread as needed. I will use LayoutInflater to inflate a layouts and place them inside game_overlay, then clear the game_overlay when needed. My rational for doing things way is that you get the best of both worlds. You don't have draw your own custom buttons to the canvas (Like a reset level button), rather leverage all that powerful android layout functionality. However you are able to perform the game rendering in the background, and have that thread stay alive all the time.</p>

<p>So now onto my questions. If you have tried something like this before I would like to hear your experience. Can I expect to pay a performance penalty for layering views like this? And more importantly would that performance hit be detrimental to the app's frame rate? Is there any other problem with this approach that you can spot. </p>
