Height half fill_parent xml

后端 未结 1 1505
误落风尘
误落风尘 2021-01-11 16:12

How I can do with LinearLayout height half fill_parent in xml?



        
相关标签:
1条回答
  • 2021-01-11 16:24

    I just want have a half of screen with 1 linearLayout and half screen with other one

    Try this

    <?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:weightSum="2"
        android:orientation="vertical" >
    
        <LinearLayout android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="#192832"></LinearLayout>
    
        <LinearLayout android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="#193222"></LinearLayout>
    
    
    </LinearLayout>
    

    Two linear layouts occupying half of the screen each.

    0 讨论(0)
提交回复
热议问题