且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

分割屏幕分成两个相等的部分,不能设置layout_weight

更新时间:2021-10-13 22:39:32

尝试低于code:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:background="#ffffff"
android:layout_height="match_parent"
android:id="@+id/main_panel">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:id="@+id/top"
>
   <ListView
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:id="@+id/list"
    android:divider="@null"
    android:dividerHeight="0dp"
    android:layout_marginTop="5dp"
    android:layout_marginBottom="5dp"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />
</LinearLayout>
<LinearLayout
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_below="@id/top"
    android:layout_weight="1"
    android:layout_alignParentBottom="true"
    android:id="@+id/ bottom">
<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/data"
    android:orientation="vertical"
    android:background="#D3D3D3"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true">

    <View
        android:id="@+id/drag_line"
        android:layout_width="50dp"
        android:visibility="visible"
        android:background="@drawable/bar"
        android:layout_gravity="center_horizontal|top"
        android:layout_height="170dp"
        android:src="@drawable/line" />

</FrameLayout>
</LinearLayout>
</RelativeLayout>