Hallo Ich arbeite gerade an einem Spiel, das VIEW der Visualisierung von Audio-Frequenz-Effekt im Hintergrund von SurfaceView enthält.Wie füge ich die Ansicht als Hintergrund zum SurfaceView hinzu?
The surfaceView contains actual game play.
ich einige Code-Schnipsel zu veröffentlichen: -
main.xml
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:background="#000" >
<co.ardor.visualizer.VisualizerView
android:id="@+id/visualizerView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</co.ardor.visualizer.VisualizerView>
</FrameLayout>
Visualizer view
werden wie folgt erstellt -
public class VisualizerView extends View
{
private static final String TAG = "VisualizerView";
private byte[] mBytes;
private byte[] mFFTBytes;
private Rect mRect = new Rect();
private Visualizer mVisualizer;
private Set<Renderer> mRenderers; // type of Renderer class
private Paint mFlashPaint = new Paint(); // for flash paint
private Paint mFadePaint = new Paint(); // for fade paint
public VisualizerView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs);
init();
}
public VisualizerView(Context context, AttributeSet attrs)
{
this(context, attrs, 0);
}
public VisualizerView(Context context)
{
this(context, null, 0);
}
// Some code regarding to the audio visualization..
}
Mein VisualizerView läuft gut so, wie ich das als Hintergrund zu Surface hinzufügen (tatsächlichem Laufe Spiel) .Ich auf dem Problem stecken ist, dass "How to add VIEW as background of surfaceView?"
Oder irgendeine andere bessere Lösung für die .. Thx im Voraus ..
Ansichten nicht als Hintergrund hinzugefügt werden. Du musst es als Inhaltsansicht deiner Aktivität einstellen. – Blackbelt