qqq.png

 현재 이런식으로 레이아웃을 만들려 합니다..

 분홍색 두개는 미리 만들어둔 layout입니다..

 이 두개를  <include > 를 이용하여 삽입하는데 하나는 맨 위에.. 하나는 맨 밑에 배치할려고 합니다..

 

 먼저 이 구성은 안됩니다..

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent">
   

   <!-- 첫번째 레이아웃 -->
   <include layout="@layout/stopwatch" />

   <LinearLayout
       android:orientation="vertical"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent" >
    <TextView
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:text="테스트" />
    

   <!-- 두번째 레이아웃 -->
       <include 
            android:layout_gravity="bottom"                  //분명 위치를 바닥으로 지정했는데 말이지요...
            layout="@layout/score" />

   </LinearLayout>
</LinearLayout>

 

현재 위의 구성은 제대로 안됩니다..

두번째 레이아웃이 젤 밑에 배치되는게 아니라 <첫번째 레이아웃><테스트 문구><두번쩨 레이아웃> 이 연속되어 나옵니다..

 

다음으로 아래의 레이아웃은 잘됩니다.. 두번쩨 include 하려는 레이아웃을 RelativeLayout안에 넣고 속성으로 부모의 바닥에 두었습니다..

 

왜 이렇게 되는걸까요 ㅡㅡ???

 

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent">
   

   <!-- 첫번째 레이아웃 -->
   <include layout="@layout/stopwatch" />

   <LinearLayout
       android:orientation="vertical"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent" >
    <TextView
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:text="테스트" />
    

   <!-- 두번째 레이아웃 -->
    <RelativeLayout
       android:layout_width="fill_parent"
       android:layout_height="wrap_content">
      <include
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          layout="@layout/score" />
    </RelativeLayout>

   </LinearLayout>
</LinearLayout>