【发布时间】:2017-12-09 15:33:52
【问题描述】:
我有一个简单的线性布局,想将屏幕分成大小相等的两个部分。
在上面,我想放一个SurfaceView,它的大小与其父级完全相同,即屏幕的一半。不幸的是,它总是要么占用所有屏幕,要么什么都不占用(取决于配置)。
为什么会这样?我该如何更改?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="2"
android:orientation="vertical">
<LinearLayout android:id="@+id/layoutUpperDaw"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#192832">
<com.example.MySurvfaceView
android:id="@+id/id_mySurfaceView"
android:layout_width="match_parent"
android:layout_height="0pt"
android:layout_weight="1"
OR
android:layout_height="match_parent"
>
</com.example.MySurvfaceView>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#193222">
...
</LinearLayout>
</LinearLayout>
【问题讨论】:
标签: android android-layout layout android-linearlayout