相关疑难解决方法(0)

如何使surfaceview透明

大家好我想让我的DrawingSurface视图透明.我试了很多东西,但它不起作用.

这是我的表面视图透明的xml代码

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <FrameLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:src="@drawable/icon" >
        </ImageView>

        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="#00000000" >

            <codewalla.android.drawings.DrawingSurface
                android:id="@+id/drawingSurface"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" >
            </codewalla.android.drawings.DrawingSurface>
        </LinearLayout>
    </FrameLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/colorRedBtn"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="10"
            android:onClick="onClick"
            android:text="R" />

        <Button
            android:id="@+id/colorBlueBtn"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="10"
            android:onClick="onClick"
            android:text="G" />

        <Button
            android:id="@+id/colorGreenBtn"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="10"
            android:onClick="onClick"
            android:text="B" />

        <Button
            android:id="@+id/undoBtn"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="10"
            android:onClick="onClick"
            android:text="U" />

        <Button
            android:id="@+id/redoBtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="10"
            android:onClick="onClick"
            android:text="R" />
    </LinearLayout>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

android surfaceview

81
推荐指数
4
解决办法
6万
查看次数

如何将视图作为背景添加到surfaceView?

嗨我目前正在制作游戏,其中包含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>
Run Code Online (Sandbox Code Playgroud)

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(); …
Run Code Online (Sandbox Code Playgroud)

android background view surfaceview

6
推荐指数
1
解决办法
1072
查看次数

标签 统计

android ×2

surfaceview ×2

background ×1

view ×1