Reputation: 3017
i want to show ListView
above ViewPager
using following code but it shows ViewPager
without ListView
above it. I used following XML
code from the link
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<ListView
android:id="@+id/wpedenyo_searched_friends_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="@color/list_divider"
android:dividerHeight="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:scaleType="fitCenter"
android:listSelector="@drawable/list_row_selector" />
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top" >
</android.support.v4.view.ViewPager></FrameLayout>
UPDATE
It showing following UI
Here jassmin is the content of
ListView
. It's showing bellow Tab
but i want it above all.
Upvotes: 0
Views: 381
Reputation: 684
I recently required something like this, Try using AutoCompleteTextView
AutoCompleteTextView textView = (AutoCompleteTextView)
findViewById(R.id.wpedenyo_searched_friends_list);
textView.setAdapter(adapter);
Upvotes: 0
Reputation: 4869
FrameLayouts are meant to hold a single child.
Try LinearLayout or RelativeLayout as the parent instead.
For example, you could make a vertically oriented LinearLayout parent and have the vertical space split evenly between your ListView and ViewPager like so:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ListView
android:id="@+id/wpedenyo_searched_friends_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="@color/list_divider"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:dividerHeight="1dp"
android:scaleType="fitCenter"
android:listSelector="@drawable/list_row_selector"/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
If you want one or the other child to take up more vertical space, adjust the layout_weights accordingly.
Upvotes: 1