读书人

多个SurfaceView的布局有关问题(同一

发布时间: 2012-08-08 14:32:45 作者: rapoo

多个SurfaceView的布局问题(同一布局内的其它的控件无法显示)
我的本意是在线性布局下放三个控件:两个SurfaceView和一个Button,我的每个控件都设置了android:layout_weight这一属性,按照比例应该是4:4:1显示的,可是最终显示的时候,Button却没显示出来。

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

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


这里是我的布局文件main.xml

XML code
<?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>




[解决办法]
把button设置text,然后把layout_weight去掉

读书人网 >Android

热点推荐