0

我有这个布局,但在运行时,只有当我删除相对和线性布局时,它才会向我显示空白空间,将窗口划分为 4 个 qurters,它显示视图是否有更简洁的方法将屏幕划分为 4 个 qurters。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/record_layoutx"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<LinearLayout
    android:id="@+id/ac_header"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:background="@color/gray0" >

    <Button
        android:id="@+id/recorder_control"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="0.54"
        android:padding="@dimen/padding_medium"
        android:text="Start" />

    <Button
        android:id="@+id/redail"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="0.49"
        android:padding="@dimen/padding_medium"
        android:text="Redail" />
</LinearLayout>

<LinearLayout
    android:id="@+id/call_body"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentBottom="true"
    android:layout_below="@id/ac_header"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/layout_221"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="0.5"
        android:orientation="horizontal" >

        <io.vov.vitamio.widget.CenterLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:orientation="vertical" >

            <SurfaceView
                android:id="@+id/surface"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </SurfaceView>
        </io.vov.vitamio.widget.CenterLayout>

        <fragment
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/call_map"
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="0.50"
            class="com.google.android.gms.maps.SupportMapFragment" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/layout_222"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="0.5"
        android:orientation="horizontal" >

        <LinearLayout
            android:id="@+id/camera_layout"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.50"
            android:orientation="vertical" />

        <LinearLayout
            android:id="@+id/info_layout"
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="0.50"
            android:orientation="vertical" />
            <TextView
    android:id="@+id/status"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="" />

    </LinearLayout>
</LinearLayout></RelativeLayout>
4

1 回答 1

0

要将您的屏幕分成 4 个部分,请执行以下操作:

    <LinearLayout 
       android:layout_height= "match_parent"
       android:layout_width= "match_parent"
       android:orientation = "vertical"
       android:weightSum = "1.0" >

    <!-- first divide this main linear layout into two vertical splits -->  

       <LinearLayout
           android:id="@+id/first_vertical_split"
           android:layout_width ="match_parent"
           android:layout_height ="0dp"
           android:layout_weight = "0.5" >

           <!-- Now split each of these vertical splits horizontally -->   

           <LinearLayout
                android:id="@+id/first_inner_horiz_split"
                android:layout_width ="0dip"
                android:layout_height ="match_parent"
                android:background="@android:color/black"
                android:layout_weight = "0.5">
           </LinearLayout>

           <LinearLayout  
              android:id="@+id/second_inner_horiz_split"
              android:layout_width ="0dip"
              android:layout_height ="match_parent"
              android:layout_weight = "0.5">
           </LinearLayout>            

       </LinearLayout> 

       <LinearLayout 
             android:id="@+id/second_vertical_split"
             android:layout_width ="match_parent"
             android:layout_height ="0dp"
             android:layout_weight = "0.5">

             <LinearLayout
                android:id="@+id/first_inner_horiz_split"
                android:layout_width ="0dip"
                android:layout_height ="match_parent"
                android:layout_weight = "0.5">
             </LinearLayout>

             <LinearLayout
              android:id="@+id/second_inner_horiz_split"  
              android:layout_width ="0dip"
              android:layout_height ="match_parent"
              android:background="@android:color/black"
              android:layout_weight = "0.5">
             </LinearLayout> 

       </LinearLayout>

    </LinearLayout>
于 2013-08-12T15:01:07.957 回答