こんにちは、私は現在、surfaceViewのバックグラウンドで可聴周波数効果の視覚化のVIEWを含むゲームに取り組んでいます。surfaceViewにバックグラウンドとしてビューを追加するには?
The surfaceView contains actual game play.
私はいくつかのコードスニペットを投稿: -
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
次のようにが作成されます -
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..
}
マイVisualizerView事前に私は"How to add VIEW as background of surfaceView?"
またはそのための別のよりよい解決策という.Iが問題に引っかかっていSurfaceView(実走行用ゲーム)の背景として、これを追加することができますどのようにうまく動作して.. Thxを..
ビューは、背景として追加することはできません。アクティビティ – Blackbelt