多个SurfaceView的布局问题(同一布局内的其它的控件无法显示)

text_now 2012-07-20 10:00:03
我的本意是在线性布局下放三个控件:两个SurfaceView和一个Button,我的每个控件都设置了android:layout_weight这一属性,按照比例应该是4:4:1显示的,可是最终显示的时候,Button却没显示出来。

其实我发现的SurfaceView类似的现象还有很多,先搞清楚这一个。

请问这是什么原因?显示效果如下图:


这里是我的布局文件main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<SurfaceView
android:layout_width="match_parent" android:layout_height="wrap_content"
android:background="@drawable/boud" android:id="@+id/sf13"
android:layout_weight="4">
<!-- drawable/boud"是我自定义的背景文件,作用是显示SurfaceView的边界 -->
</SurfaceView>
<SurfaceView
android:layout_width="match_parent" android:layout_height="wrap_content"
android:background="@drawable/boud" android:id="@+id/sf15"
android:layout_weight="4">
</SurfaceView>
<Button android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/bt22"
android:layout_weight="1"/>
</LinearLayout>


...全文
511 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
hvk687 2012-07-20
  • 打赏
  • 举报
回复
把button设置text,然后把layout_weight去掉

80,349

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧