2016-11-14 5 views
1

공간의 나머지 부분을 차지해야하는 중첩 된 조각을 갖고 싶습니다. 문제는 높이가 1 픽셀이기 때문에 표시되지 않는 것입니다. 예를 들어 높이를 300dp로 설정하면 모든 것이 정상적으로 보입니다. 여기 내 코드가있다. 무게로 작업 할 때나머지 공간을 채우는 중첩 된 조각

enter image description here

+0

모든 중첩 된 레이아웃 (성능 및 디자인이 좋지 않은 경우)을 사용하는 대신 단일 RelativeLayout을 사용할 수 있습니다. 또는이 경우에는 단일 LinearLayout (빠른 것도 가능)입니다. –

+0

레이아웃은 모든 하위 레이아웃 내부에 많은 뷰가있는 복잡한 요소입니다. 이러한 이유로 주 논리 만 보여주었습니다. – charbinary

+0

당신이 보여준 것을 위해, 단 하나의 LL로 충분합니다. 더 복잡한 경우 단일 RL 사용을 고려하십시오. –

답변

0

이 LiniearLayout의 모든 어린이들이이 있어야합니다 어쩌면 레이아웃 그것은 다음과 같아야 다른 두 개의 레이아웃 :

  <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_marginTop="5dp" 
      android:orientation="vertical"> 

      <RelativeLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:background="@drawable/white_with_divider_bg" 
       android:id="@+id/firstL"> 

      </RelativeLayout> 

      <RelativeLayout 
       android:id="@+id/secondL" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="5dp"> 

      </RelativeLayout> 

      <FrameLayout 
       android:id="@+id/child_fragment" 
       android:layout_height="0dip" 
       android:layout_width="match_parent" 
       android:layout_weight="1"/> 

     </LinearLayout> 

을 높이 무엇인지 계산할 수 없습니다 체중,하지만 그것은 당신을 도울 수 없습니다. android : id = "@ + id/child_fragment"에 height = "match_parent"가 있어야하며 가중치를 제거해야합니다.

그래야합니다.

+0

나는 그것을 시도하고 동일합니다. – charbinary

+0

흠. 시도 할 수있는 또 다른 해결책은 LiniearLayout을 RelativeLayout으로 대체하고 위와 아래의 속성을 사용하여 자녀에게 줄 수있는 방법입니다. – miqueloi