Reputation: 15744
Here is my xml file for my layout
:
<com.handmark.pulltorefresh.library.PullToRefreshScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pull_to_refresh_scrollview_feat"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ListView
android:id="@+id/listViewFriends"
android:layout_width="match_parent"
android:layout_height="1100dp" >
</ListView>
<ListView
android:id="@+id/listViewTrending"
android:layout_width="match_parent"
android:layout_height="1100dp" >
</ListView>
</LinearLayout>
</com.handmark.pulltorefresh.library.PullToRefreshScrollView>
For some reason, the only way to show both ListViews
is by setting height in actual dp
's. I can't use wrap_content
or layout_weights
.
Is this a limitation of using multiple ListViews
? Or am I doing it wrong?
Upvotes: 0
Views: 292
Reputation: 15744
I simply scrapped this idea and used a MergeAdapter
and got what I was looking for.
Upvotes: 1
Reputation: 400
I have not tried this, but could you set layout_height=0dp and layout_weight=1 to your ListViews and see what happens?
Hope it helps.
Upvotes: 0
Reputation: 234867
I assume PullToRefreshScrollView
is some sort of ScrollView
. You should not use a ListView
inside a ScrollView
; they just do not play well together. Not only must you must set an explicit layout height for the list(s), but the two views will get in each other's way in dealing with touch events.
If you promote the LinearLayout
to the top of the container hierarchy, you can set the following attributes for each ListView
:
. . .
android:layout_height="0dp"
android:layout_weight="1"
. . .
They should then take up the same vertical space.
Upvotes: 0