android - 背景在表面 View 中不可见

标签 android android-layout

当我尝试将自定义 View 添加到框架布局时,我创建了一个扩展表面 View 的 View ,但框架布局背景不可见。请提供解决方案。

最佳答案

你必须在表面 View 中自己渲染背景。作为documentation说:

the SurfaceView punches a hole in its window to allow its surface to be displayed.

所以放置在表面 View 后面的任何东西都不会被渲染。

关于android - 背景在表面 View 中不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5243958/

相关文章:

java - 为什么这段Java代码在Eclipse中的结构是这样的?

android - 如何在 libgdx 的舞台上绘制位图字体?

java - 如何设置RelativeLayout背景颜色?

android - 为 Android 开发 PhoneGap - 不同屏幕尺寸/像素密度的最佳实践

java - Android、Eclipse : Item in . xml 布局未在图形布局中显示

android - Lollipop 版软键盘隐藏EditText

android - 手势字符识别

android - 如何添加没有日期对象而不是日历对象

android - 电话休眠时停止服务

xml - 如何对xml中的值求和?