2016-11-28 13 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が終わるところで正確に始めることです。これを引き起こしているのは何ですか? linearlayoutではなくscrollviewを使用する必要がありますか?ここで

は、スクリーンショットを明らかにすることである: enter image description here

私は拡張可能なリストビューは、リストビューの下に表示します。

答えて

1

私は問題は、paddingBottom="116dp"ListViewにあり、ExpandableListViewを押し込んでいると思います。

+0

うわー...初心者の間違い...あなたの答えはありがとう...と私は大規模なリストのためのscrollviewでLinearLayoutをラップするか、それは正常に動作しますか? – Asym

+0

私はAndroidのキャリアの初めに書いたコードを振り返ってみると、夜中に叫び声を上げたいと思うようになります。 ScrollViewsでリストを折り返すと、いくつかの奇妙な問題が発生する可能性がありますが、ScrollViewは必要ありません。 – LukeWaggoner

+0

ありがとうございました! :D – Asym

関連する問題