2016-11-28 1 views
2

이 레이아웃이 있습니다.LinearLayout - 위치 지정보기

<RelativeLayout 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:ads="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
    > 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/numbers_root" 
     android:orientation="vertical" 
     android:gravity="top" 
     > 
     <ListView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/numbersList" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="116dp" 
    android:clipToPadding="false" 
    tools:layout_height="100dp" 
    ></ListView> 
     <ExpandableListView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/subcategory_expandable" 
      > 
     </ExpandableListView> 

    </LinearLayout> 
</RelativeLayout> 

는 그러나 문제는 ExpandableListView는 항상 부모 레이아웃에 gravity="top"에도 불구하고 화면 중앙에 있다는 것입니다. 내가 원하는 것은 ListView가 끝나는 곳에서 정확히 시작하도록하는 것입니다. 무슨 일이 일어날 지 모르는 어떤 생각? 선형 레이아웃 대신 scrollview를 사용해야합니까? 여기

은 스크린 샷을 명확히하는 것입니다 enter image description here

내가 확장 목록보기가 목록보기 아래에 표시 할.

답변

1

나는 문제가 있다고 생각한다. paddingBottom="116dp"ListView이고 ExpandableListView은 아래로 밀고있다.

+0

와우 ... 초보자 실수 ... 답장을 보내 주셔서 감사합니다 ... 큰 목록의 경우 scrollview에서 LinearLayout을 래핑해야합니까, 아니면 정상적으로 작동할까요? – Asym

+0

안드로이드 경력의 시작 부분에 썼던 코드를 되돌아 보면, 밤새 비명을 지르고 싶습니다. ScrollViews의 목록을 래핑하면 이상한 문제가 발생할 수 있지만 ScrollView가 필요하지 않습니다. – LukeWaggoner

+0

감사합니다. :디 – Asym