bogerchan / Nier-Visualizer

A lightweight and efficient Android visual library.
Apache License 2.0
576 stars 75 forks source link

How To set background color to transparent #21

Closed adiio closed 5 years ago

adiio commented 5 years ago

curently default background color is black,is it posible to change? if yes,how ?

adiio commented 5 years ago

my bad, its on surface view not in your visualizer, i never use surface view before, surface view default background is black here how i change surface view background color

1.add frame layout

<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent"android:background="@android:color/transparent">

<com.example.surfacetest.MySurface
    android:id="@+id/surface"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

2.add the following for the SurfaceView instance

surfaceView.setZOrderOnTop(true); surfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);