Android 在surfaceview上添加不透明按钮
在我的应用程序中,我想实现一个包含一些按钮的屏幕,作为屏幕的背景,我想要一个显示一些动画的表面视图。为此,我扩展了显示动画的曲面视图。我面临的问题是,当我添加一些按钮时,它们不是完全不透明的。它们保持透明,我可以通过它们看到背景动画。我试着将按钮的背景色设置为FF000000,但它并不是完全不透明的 这是我的活动_main.xmlAndroid 在surfaceview上添加不透明按钮,android,surfaceview,Android,Surfaceview,在我的应用程序中,我想实现一个包含一些按钮的屏幕,作为屏幕的背景,我想要一个显示一些动画的表面视图。为此,我扩展了显示动画的曲面视图。我面临的问题是,当我添加一些按钮时,它们不是完全不透明的。它们保持透明,我可以通过它们看到背景动画。我试着将按钮的背景色设置为FF000000,但它并不是完全不透明的 这是我的活动_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" x
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/bg_view"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.myproj.example.widgets.CustomSurfaceView
android:id="@+id/surface_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/test_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#FF000000"
android:text="Should be Opaque" />
</RelativeLayout>
</FrameLayout>
</RelativeLayout>
我试过了,
,
但是按钮仍然不是不透明的。尝试添加一个不透明的可绘制按钮作为背景。使用8000000-
<Button
android:id="@+id/test_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#80000000"
android:text="Should be Opaque" />
尝试了的裁剪版本。仍然透明。在玩Grafika时,我发现某些主题有部分透明的UI元素。如果我切换到android:theme=@android:style/theme.NoTitleBar.Fullscreen,小部件就会失去透明度。你解决了吗?我问了一个类似的问题。