2017-04-26 1 views
0

여기 내 코드입니다. 도구 모음의 위치는 고정되어 있습니다. 당신은 어떻게 그것들 사이의 중간 레이아웃 (그리드 /리스트 뷰)을 정확히 늘릴 수 있습니까?두 도구 모음간에 레이아웃을 늘이는 가장 좋은 방법은 무엇입니까?

미리 감사드립니다.

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

<include layout="@layout/toolbar" 
    android:id="@+id/top_toolbar"/> 

<RelativeLayout 
    android:id="@+id/ll_view" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:layout_alignTop="@+id/top_toolbar"> 

    <GridView 
     android:id="@+id/gv_grid" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="center" 
     android:numColumns="auto_fit" /> 

    <ExpandableListView 
     android:id="@+id/id_list_view" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:descendantFocusability="blocksDescendants" 
     android:visibility="gone"/> 

</RelativeLayout> 

<include layout="@layout/bottom_toolbar"/> 

답변

1

나는 LinearLayout에 대한 첫 번째 RelativeLayout을 변경하고과 같이 두 번째 RelativeLayoutandroid:layout_weight="1"를 추가 :

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

<include layout="@layout/toolbar" 
    android:id="@+id/top_toolbar"/> 

<RelativeLayout 
    android:id="@+id/ll_view" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_weight="1" 
    android:orientation="vertical" 
    android:layout_alignTop="@+id/top_toolbar"> 

    <GridView 
     android:id="@+id/gv_grid" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="center" 
     android:numColumns="auto_fit" /> 

    <ExpandableListView 
     android:id="@+id/id_list_view" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:descendantFocusability="blocksDescendants" 
     android:visibility="gone"/> 

</RelativeLayout> 

<include layout="@layout/bottom_toolbar"/> 

+0

작품을 잘, 감사합니다. – chaturanga

관련 문제