【发布时间】:2015-02-25 08:34:49
【问题描述】:
在我的应用程序中,我想实现一个应该包含一些按钮的屏幕,并且作为屏幕的背景,我想要一个显示一些动画的表面视图。为此,我扩展了显示动画的表面视图。我面临的问题是,当我添加一些按钮时,它们并不是完全不透明的。它们保持透明,我可以通过它们看到背景动画。我尝试将按钮的背景颜色设置为#FF000000,但它仍然不是完全不透明的。
这是我的 activity_main.xml
<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>
我试过Android:How to add a button in surface view, Rendering a button over SurfaceView, 但是按钮仍然不是不透明的。
【问题讨论】:
-
在玩 Grafika 时,我发现某些主题具有部分透明的 UI 元素。如果我切换到
android:theme="@android:style/Theme.NoTitleBar.Fullscreen",小部件就会失去透明度。 -
你解决了吗?我问了一个类似的问题。 stackoverflow.com/questions/29266322/…
标签: android surfaceview